Friday, July 3, 2015

Cordova - A error is ANDROID_HOME is not set

■ To deploy the application to the emulator from the command line:
■ There is a error like the following.
$ cordova emulate android
Running command: /Users/kim_woongjoon/git/hello/platforms/android/cordova/run --emulator
ERROR: Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.
Error: /Users/njoonk/git/hello/platforms/android/cordova/run: Command failed with exit code 2
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:134:23)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:755:16)
    at Process.ChildProcess._handle.onexit (child_process.js:822:5)


--------------------------SOLUTION----------------------------
■ Install Android Studio on your computer.
■ Add the following phrase to .profile on your mac.
$ vim ./.profile
## Android SDK
export ANDROID_HOME=/Users/njoonk/android-sdks
export PATH=$ANDROID_HOME/bin:$PATH


-----------------------------OUT---------------------------------
Built the following apk(s):
    /Users/njoonk/git/hello/platforms/android/build/outputs/apk/android-debug.apk
Installing app on emulator...
Using apk: /Users/njoonk/git/hello/platforms/android/build/outputs/apk/android-debug.apk
Launching application...
LAUNCH SUCCESS

No comments:

Post a Comment