List installed sdk package via command line

冷暖自知 提交于 2020-01-12 02:49:05

问题


I want to list the installed sdk packages by command lines.(For some reasons I cannot use the GUI)

I have done some research and found out several commands to list the available packages on the remote server, but I fail to find any command to list the installed sdk packages yet.

Thanks


回答1:


With Android SDK Tools 25.2.3 (and higher):

$ANDROID_HOME/tools/bin/sdkmanager --list

See: https://developer.android.com/studio/command-line/sdkmanager.html#usage




回答2:


As described in $ANDROID_HOME/tools/android list --help

  • list : Lists existing targets or virtual devices.
  • list avd : Lists existing Android Virtual Devices.
  • list target : Lists existing targets.
  • list device : Lists existing devices.
  • list sdk : Lists remote SDK repository.

I guess you are looking for this:

$ANDROID_HOME/tools/android list target

You can learn more on the android tool in the Command Line Reference.

Good luck!




回答3:


On my mac just sdkmanager --list was not working, path needed to be specified.

Using android studio default SDK location the path is ~/Library/Android/sdk/tools/bin/sdkmanager --list

As mentioned by @tnissi this is for Android SDK Tools 25.2.3 (and higher).

Or add the path by: export PATH=$PATH:~/Library/Android/sdk/tools/bin




回答4:


It's not quite a listing, but the source.properties files give details of the provenance. I'm using this to compare SDKs on different machines:

for i in $(find -name source.properties); do
  if [ -e ../other.sdk/$i ] ; then
    echo ========================= $i
    diff -wu $i ../other.sdk/$i | grep -v Pkg.License
  fi
done

I strip Pkg.License because it's hyoooj.




回答5:


A bit old topic but I had similar problem, And noticed that avdmanager lists installed platforms as targets

"%ANDROID_SDK_ROOT%\tools\bin\avdmanager" list target

Available Android targets:==============] 100% Fetch remote repository...
----------
id: 1 or "android-25"
     Name: Android API 25
     Type: Platform
     API level: 25
     Revision: 3
----------
id: 2 or "android-28"
     Name: Android API 28
     Type: Platform
     API level: 28
     Revision: 6


来源:https://stackoverflow.com/questions/31886049/list-installed-sdk-package-via-command-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!