Android - Command not found

前端 未结 9 1878
情书的邮戳
情书的邮戳 2020-12-07 11:37

I am trying to run the command in ubuntu

android update project --path .

However I am getting a android:command not found

相关标签:
9条回答
  • 2020-12-07 12:23

    On MacOS/Linux, define the path to wherever you installed your SDK as ANDROID_HOME:

    MacOS

    $ export ANDROID_HOME=/Applications/android-sdk-macosx
    

    If you installed Android Studio, the value will need to be

    export ANDROID_HOME=$HOME/Library/Android/sdk
    

    Linux

    $ export ANDROID_HOME=~/android-sdk-linux
    

    Then add the paths to the platform-tools and tools sub-directories (Same on MacOS/Linux).

    export PATH=$ANDROID_HOME/tools:$PATH
    export PATH=$ANDROID_HOME/platform-tools:$PATH
    

    You should now be able to run android from the shell.

    If none of the suggested ANDROID_HOME paths above are valid, you can find the (uniquely and consistently named) platform-tools folder via:

    find / -name platform-tools 2>/dev/null
    

    Whatever path that returns will need to be trimmed down to end with either sdk, android-sdk-linux, or android-sdk-macosx.

    0 讨论(0)
  • 2020-12-07 12:26

    Assuming that you have set ANDROID_HOME to point to the sdk install, you should add $ANDROID_HOME/tools and $ANDROID_HOME/platform-tools to your PATH.

    0 讨论(0)
  • 2020-12-07 12:26

    For Mac, go into your home directory by typing cd ~, and then type vi .bash_profile, This file might be empty or just created, and this is not a problem.

    To edit the file, press i on your keyboard and inside the file, type the following path:

    export PATH="/Users/YOUR-USERNAME-HERE/Library/Android/sdk/platform-tools":$PATH
    export PATH="/Users/YOUR-USERNAME-HERE/Library/Android/sdk/tools":$PATH
    

    When you are done, press esc, and again press shift : and type wq. Okay, now you saved your file. Now, quit terminal and re-launch, and try typing:

    adb -h
    android -h
    

    If both commands are giving you output, it means everything works fine.

    Not: We used vi command to edit the file. If you got confused with this command, you can also try nano for editing the file.

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