0
votes

I've installed Ionic Lab and have downloaded a small test app (so I can be sure the code itself is error free).

In Ionic Lab I've successfully installed iOS and Android and the test app opens and runs in the iOS emulator.

So far so good!

However, when I attempt to run in Android (Apps -> Run Android) I see the following error:

Error: /Users/andy/Library/Containers/nz.co.pixeleyes.AutoMounter/Data/Library/Application Support/AutoMounter/Mounts/[email protected]/SMB/Programming/Cross platform dev/Ionic/Test/platforms/android/cordova/run: Command failed with exit code 2 Error output: ERROR: Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.

Screen shot of error

I've added the location of the Android SDK to my $PATH variable in ~/.bash_profile (also tried ~/.bashrc) however I suspect this will only work for command line builds. I updated my /etc/paths file to include the location of the SDK tools and platform-tools folder.

/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/andy/Library/Containers/nz.co.pixeleyes.AutoMounter/Data/Library/Application\ Support/AutoMounter/Mounts/[email protected]/SMB/Programming/Android/sdk/tools:/Users/andy/Library/Containers/nz.co.pixeleyes.AutoMounter/Data/Library/Application\ Support/AutoMounter/Mounts/[email protected]/SMB/Programming/Android/sdk/platform-tools

However, I still see the same error when attempting to run Android from Ionic Lab

A bit stumped what else to try. Android Studio doesn't mind the strange location of the SDK so I don't really fancy moving it if I don't have to.

Would welcome any ideas.

1

1 Answers

0
votes

I faced this issue in starting, its really annoying:

If you are using linux go with this:

  export PATH=${PATH}:/Applications/Android\ Studio.app/sdk/platform-tools:/Applications/Android\ Studio.app/sdk/tools
  export JAVA_HOME=$(/usr/libexec/java_home)
  export PATH=${JAVA_HOME}/bin:$PATH
  export PATH=/usr/local/bin:$PATH

secondary option: edit .bash_profile inside root directory. check this out

and for this

# source ~/.bash_profile
# echo $ANDROID_HOME

it success, but when i open another tab/terminal or after restarting the computer, it's return error/blank again ~_~

Optionally:

in windows OS

set PATH=%PATH%;C:\Users\userName\AppData\Local\Android\android-sdk\tools;C:\Users\userName\AppData\Local\Android\android-sdk\platform-tools

IN mac

export PATH=${PATH}:/Users/userName/Documents/android-sdk-mac_x86/platform-tools:/Users/userName/Documents/android-sdk-mac_x86/tools

Thanks if you still face issues, let me know.