sdkmanager --package_file=/sdk/packages.txt not working
fgsalomon opened this issue · comments
It seems that packages installation is not working because sdkmanager is rejecting the argument:
Step 12 : RUN mkdir -p /root/.android && touch /root/.android/repositories.cfg && ${ANDROID_HOME}/tools/bin/sdkmanager --update && (while [ 1 ]; do sleep 5; echo y; done) | ${ANDROID_HOME}/tools/bin/sdkmanager --package_file=/sdk/packages.txt
---> Running in acf3a5e88ad9
done
Warning: Unknown argument --package_file=/sdk/packages.txt
I didn't find any cause/solution to this.
Hi @fgsalomon ,
In my case I put a variable with the file .txt
in Dockerfile and add --verbose
.
like this:
ENV ANDROID_PACKAGES_FILE packagesFile.txt
...
... ${ANDROID_HOME}/tools/bin/sdkmanager --verbose --package_file=${ANDROID_PACKAGES_FILE}
I'm currently working on this, the --package_file
doesn't work for me either, i'm now switching to just passing the list of packages as a string argument.
@BrunoAgrizzi that didn't work for me, thanks anyway.
@jangrewe thank you for the update!
I just got bitten by that myself. Google knows about that and the fix is supposedly pending https://issuetracker.google.com/issues/66465833
Another workaround is to run the --package_file install step before --update. The download package has older non-broken sdkmanager before you run update.
Looks like this has been fixed in June, but its still a problem now
@gittiago12 if you look closely at
https://developer.android.com/studio/#downloads
and
https://developer.android.com/studio/releases/sdk-tools
You will notice that Android has not updated the sdk manager since last year.
So I am doing it manually and line by line until Google updates it
sdkmanager "add-ons;addon-google_apis-google-24"
sdkmanager "add-ons;addon-google_apis-google-24"
sdkmanager "build-tools;28.0.3"
sdkmanager "extras;android;m2repository"
sdkmanager "extras;google;google_play_services"
sdkmanager "extras;google;m2repository"
sdkmanager "platform-tools"
sdkmanager "platforms;android-28"
sdkmanager "extras;google;instantapps"
sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2"
sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2"
@gittiago12 I'm not sure if this is the right place to complain about the package manager, as i'm also just a user, not the developer ;-)
If you have a look at my Dockerfile, i bypass this by passing the packages as string from the text file, instead of the text file itself:
RUN while read -r package; do PACKAGES="${PACKAGES}${package} "; done < /sdk/packages.txt && \
${ANDROID_HOME}/tools/bin/sdkmanager ${PACKAGES}
Not sure if this will help anyone, but it was working for me if I do
RUN while read -r package; do PACKAGES="${PACKAGES}${package} "; done < /sdk/packages.txt && yes | ${ANDROID_HOME}/tools/bin/sdkmanager ${PACKAGES}
Instead of what @jangrewe mentioned
You only need to pipe the output of yes
to sdkmanager
if you don't have the licenses, as having the licenses make the SDK Manager not even ask for input.
And as you can see from the images built on Docker Hub, piping yes
is not needed if you do all the steps my Dockerfile does.