Cannot install sdkmanager in windows 10

前端 未结 2 1686
难免孤独
难免孤独 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.(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\\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

提交回复
热议问题