Cordova platform add android error using mac


#1

Hi im using ionic i already made an ios version of this one and it is successful but when i am creating the android version it has an error

Judes-MacBook-Air:ezapp jude$ cordova platform add android
Running command: /Users/judegimeno/desktop/app2/ezapp/hooks/before_platform_add/init_directories.js /Users/judegimeno/desktop/app2/ezapp
Adding android project...
Creating Cordova project for the Android platform:
	Path: ../../../desktop/app2/ezapp/platforms/android
	Package: com.ezapp
	Name: ezapp
	Activity: MainActivity
	Android target: android-24
Subproject Path: CordovaLib
Android project created with cordova-android@6.0.0
Installing "cordova-plugin-console" for android
Failed to install 'cordova-plugin-console':CordovaError: Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually.
Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.
    at /Users/judegimeno/desktop/app2/ezapp/platforms/android/cordova/lib/check_reqs.js:222:19
    at _fulfilled (/Users/judegimeno/desktop/app2/ezapp/platforms/android/cordova/node_modules/q/q.js:834:54)
    at self.promiseDispatch.done (/Users/judegimeno/desktop/app2/ezapp/platforms/android/cordova/node_modules/q/q.js:863:30)
    at Promise.promise.promiseDispatch (/Users/judegimeno/desktop/app2/ezapp/platforms/android/cordova/node_modules/q/q.js:796:13)
    at /Users/judegimeno/desktop/app2/ezapp/platforms/android/cordova/node_modules/q/q.js:857:14
    at runSingle (/Users/judegimeno/desktop/app2/ezapp/platforms/android/cordova/node_modules/q/q.js:137:13)
    at flush (/Users/judegimeno/desktop/app2/ezapp/platforms/android/cordova/node_modules/q/q.js:125:13)
    at nextTickCallbackWith0Args (node.js:420:9)
    at process._tickCallback (node.js:349:13)
Error: Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually.
Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.

#2

try to remove and add again android platform… some plugins are not properly installed inside android platforms plugin directory…


#3

The error says it can’t find the Android SDK on your machine.

Do you have the Android SDK installed?

If yes, then you should locate it. I think $ which android should show you were it installed.

If no, then download and install it. The easiest way to do is with Android Studio: https://developer.android.com/studio/index.html
Although there are ways of downloading just the SDK without the full IDE, you can google the specific instructions for your laptop OS.


#4

set the path for environment ANDROID_HOME into your computer environment variables…