Cannot install sdkmanager in windows 10

前端 未结 2 1664
难免孤独
难免孤独 2021-01-12 01:47

I am trying to install the sdk manager alone for using it with Eclipse. I downloaded the zip file provided by google -

commandlinetools-win-6200805_latest.zip

相关标签:
2条回答
  • 2021-01-12 02:36

    TL;DR;

    • copy the content of tools/lib/_ to tools/lib
    • run sdkmanager commands with --sdk_root parameter.

    Details

    In the line 66 of the sdkmanager.bat, CLASSPATH is defined to be like this

    set CLASSPATH=%APP_HOME%\lib\/sdkmanager-classpath.jar
    

    and inside the lib directory, sdkmanager-classpath.jar is, oddly, under a subdirectory called -.

    I tried to change the path in the batch file but it did not work, so I copied the files from ..../tools/lib/_ to ..../tools/lib and the error disappeard. However, a warning appeared:

    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)
    

    According to this answer, I tried to pass the --sdk_root parameter which worked without problems:

    sdkmanager --sdk_root=%ANDROID_HOME% --list
    # %ANDROID_HOME% is the environment variable that contains the path of android
    # sdk installation. Typically, would be:
    # `C:\Users\<USERNAME>\AppData\Local\Android\Sdk\tools`
    

    PS: even I was able to solve this, I would say that this answer is a workaround since the documentation does not mention anything about copying files to other path

    0 讨论(0)
  • 2021-01-12 02:41

    I post this for my short note upon the solution. After done several research only specify sdk_root parameter solve Java problem.

    sdkmanager --sdk_root=%ANDROID_HOME% --install [Package_name]
    

    Where %ANDROID_HOME% specify a PATH to android SDK extracted. e.g. "d:\android-sdk" Package_name can be obtained from --list option.

    sdkmanager --sdk_root=%ANDROID_HOME% --list
    

    I use this for Appium so only platform-tools, platforms [API Level] Should be fine. Emulator if you want to use AVD.

    0 讨论(0)
提交回复
热议问题