Cordova Android Install On Linux

12,895

After a lot of trial an error, it seems the issue was "sudo" all along. Sometimes it's the simplest things that we overlook.

There were also some unnecessary lines in my export commands. The following is all you need:

export ANDROID_HOME=~/adt-bundle-linux-x86_64-20140702/sdk
export PATH=${PATH}:~/adt-bundle-linux-x86_64-20140702/sdk/tools
export PATH=${PATH}:~/adt-bundle-linux-x86_64-20140702/sdk/platform-tools

If you get an error that ANDROID_HOME does not exist, change the location to use the absolute path. ie: /home/user_name/....

My project directory needed to be 777, as well.

Finally, make sure you run the following command:

sudo apt-get install lib32stdc++6

Looks like without it, I get build errors.

Hope this helps anyone else in the future. There definitely was not enough clear answers on the web, before.

Share:
12,895

Related videos on Youtube

Kovo
Author by

Kovo

Updated on September 18, 2022

Comments

  • Kovo
    Kovo almost 2 years

    I've been pulling my hair out for the past two days trying to get cordova to detect and install the android platform for a project.

    The specific error:

    Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.
    
    Command finished with error code 8
    

    I have scoured the net for solutions. Here is the .bashrc file:

    export ANDROID_HOME=~/adt-bundle-linux-x86_64-20140702/sdk/platform-tools
    export ANDROID_SDK_HOME=~/adt-bundle-linux-x86_64-20140702/sdk/platform-tools
    export PATH=${PATH}:~/adt-bundle-linux-x86_64-20140702/sdk/tools
    export PATH=${PATH}:~/adt-bundle-linux-x86_64-20140702/sdk/platform-tools
    

    I get the error when running this command:

    sudo cordova platform add android -d
    

    Any help would be appreciated!

    More Info:

    If I run the "android" command, I get the SDK app startup, so I know that works. Ive also installed the latest builders, tools for the SDK.

    • Daniele Vrut
      Daniele Vrut almost 10 years
      Maybe you are starting cordova as root and that causes differences in PATH. It's just an idea, not a solution, sorry.
    • Kovo
      Kovo almost 10 years
      @DanieleBrugnara looks like sudo was part of the problem. Not sure why I never bothered to try without it. There was a list of other issues I ran into after the fact, but I was able to find the solutions to those. Thanks!
    • Daniele Vrut
      Daniele Vrut almost 10 years
      @Kovo: glad that helped.