How to configure Android SDK correctly using commandlinetools in Windows

一世执手 提交于 2021-02-11 16:51:25

问题


The version of commandlinetools downloaded is commandlinetools-win-6200805_latest.zip. Unzip this I got the directory as following:

.
└── tools
    ├── NOTICE.txt
    ├── bin
    ├── lib
    └── source.properties

Then I change the directory name from commandlinetools-win-6200805_latest.zip to sdk and copy sdk to C:\AndroidSdk, which is a behavior of file management.

I have read the mannual of sdkmanager provided by Android.

When I using the command sdkmanager --list, the batch file gave me the warning information as following:

Warning: Could not create settings
java.lang.IllegalArgumentException
        at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.<init>(SdkManagerCliSettings.java:428)
        at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.createSettings(SdkManagerCliSettings.java:152)
        at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.createSettings(SdkManagerCliSettings.java:134)
        at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:57)
        at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)

I got a workaround from this answer, and my env value ANDROID_HOME is C:\AndroidSdk\sdk and I run sdkmanager --sdk_root=%ANDROID_HOME% "platform-tools" in C:\AndroidSdk\sdk\tools\bin.

It works fine setting the common argument --sdk_root, but it's complicated.

I thought there is some wrong with the usage or path of sdkmanager, but I cannot prove that. And I want to know the method to operate sdkmanager without --sdk_root in my case.

来源:https://stackoverflow.com/questions/60735616/how-to-configure-android-sdk-correctly-using-commandlinetools-in-windows

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