Isaachi1 / androidsdk-install

GNU General Public License v3.0
1 stars 0 forks source link

sdkmanager não funciona sem o parâmetro sdk_root #5

Open edumco opened 4 years ago

edumco commented 4 years ago

Quando chamamos o sdkmanager sem passar o parâmetro sdk_root é exibida uma mensagem de erro e commandos não funcionam:

Mensagem de erro:

eduardo@note:~/Android/tools/bin$ ./sdkmanager --version
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)
Usage:
  sdkmanager [--uninstall] [<common args>] [--package_file=<file>] [<packages>...]
  sdkmanager --update [<common args>]
  sdkmanager --list [<common args>]
...

Quando passamos um ponto ou o ANDROID_HOME o comando funciona:

eduardo@note:~/Android/tools/bin$ ./sdkmanager --sdk_root=$ANDROID_HOME --version
3.6.0
edumco commented 4 years ago

Depois de alguma pesquisa encontrei a seguinte resposta

Starting from Android SDK Command-line Tools 1.0.0 (6200805), in contrast to Android SDK 26.1.1 (4333796), the tools directory hierarchy has been changed. Previously it was placed right inside ANDROID_HOME, now it's still named as tools (the only thing you'll get after unpacking the downloaded commandlinetools zip file), but differently, you have to place it inside a directory called cmdline-tools on your own. The name cmdline-tools comes from its package name, where you can get from listing packages command sdkmanager --list, whose outputs include cmdline-tools;1.0 | 1.0 | Android SDK Command-line Tools.

👆 A estrutura de pastas mudou com as ferramentas de linha de comando e o nome do zip deveria ser o nome da pasta criada

Wrapping tools directory inside cmdline-tools directory would make it work ...

👆 Colocar a pasta tools dentro de uma pasta cmdline-tools faz ele funcionar

cmdline-tools should not be set as ANDROID_HOME ...

👆 A pasta cmdline-tools não deve ser usado como ANDROID_HOME

Recapitulando

Link pra resposta original: https://stackoverflow.com/a/61176718/13323250