質問

How do you download the Android support library via the command line?

For example:

echo y | android update sdk --no-ui --filter "android-19"
役に立ちましたか?

解決

echo y | android update sdk --no-ui --all --filter "extra-android-m2repository"

他のヒント

android command is deprecated now

You can use sdkmanager instead like so:

sdkmanager --install "extras;android;m2repository"
sdkmanager "extras;android;m2repository"

worked for me.
I ran in to the error: Warning: File /var/root/.android/repositories.cfg could not be loaded.

so I had to create that file before running the above command.

touch ~/.android/repositories.cfg

The sdkmanager should be your go to. Otherwise, there is another way which is what sdkmanager will do automatically. So, there are dangers to this, one typo and the whole thing will not work. Go to Google Sources repository and choose either support or m2repository and download by clicking the tgz/archive link under the breadcrumbs.

Or use;

wget https://chromium.googlesource.com/android_tools/+archive/master/sdk/extras/android.tar.gz

The second option downloads a bigger file size (and two versions of the support library but neither is the newer androidX referenced on the official Android development page). But, both will give you a zipped archive with the Android support library. Go to your directory and create the extras directory. Use "extras/android" as a file path and unzip (use tar xvfj) your archive into it;

unzip <archive file>
mv -R <unzipped directory> <Android SDK home>/extras/android/
mv -R <unzipped and moved directory> <support>

Or

tar xvjf <archive file>
mv -R <unzipped directory> <Android SDK home>/extras/android/
mv -R <unzipped and moved directory> <support>

You should now have the Android support library installed in your SDK package.

Further support in use.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top