Following the installation tutorial I have been able to execute the “cordova build” command. When I then try the next emulate command I get the following:
cordova emulate android
Generating config.xml from defaults for platform "android"
Preparing android project
Running on emulator for platform “android” via command “/Users/SM/Desktop/projects/devAPIS/hybrid-iconic/hello/platforms/android/cordova/run” --emulator
[Error: An error occurred while emulating/deploying the android project.
/Users/SM/Desktop/projects/devAPIS/hybrid-iconic/hello/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error executing “adb devices”: /bin/sh: adb: command not found
]
Is this something I can fix via the “android” command. What piece am I missing?
Using the android SDK manager I saw that I have API 17 installed but the API 19 version of the Android SDK Build-Tools. So I remove it and install the Android SDK Build-Tools for API 17. This does not make a difference and I still get the following error:
cordova emulate android
Generating config.xml from defaults for platform "android"
Preparing android project
Running on emulator for platform “android” via command “/Users/SuperstringMedia/Desktop/projects/devAPIS/hybrid-iconic/hello/platforms/android/cordova/run” --emulator
[Error: An error occurred while emulating/deploying the android project.
/Users/SuperstringMedia/Desktop/projects/devAPIS/hybrid-iconic/hello/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error executing “adb devices”: /bin/sh: adb: command not found
But can you execute the adb command from the terminal?, if that is working fine then maybe is a bigger issue with your SDK or something, I can’t help you more than that
Finally cd’ed into the platform-tools directory and ran ./adb --help. Worked fine, from there I came to the quick conclusion that I had modified a path string and it had a typo.
So, good news is it is fixed and I’m now running the emulator, however it now opens fairly fast and the title shows in the Apple menu bar area and then it dies right away. Tried it a few times with same result, it flashes open then closes right away.
Any ideas on why?
The following just hangs in the terminal with the cursor blinking even after the emulator dies:
cordova emulate android
Generating config.xml from defaults for platform "android"
Preparing android project
Running on emulator for platform “android” via command “/Users/SM/Desktop/projects/devAPIS/hybrid-iconic/hello/platforms/android/cordova/run” --emulator
Thanks, l used “android avd” to define a new device according to link called “how-can-i-create-a-avd-for-samsung-galaxy-note-2” on stackoverflow. Sorry I can’t paste whole link because of the extra images it add and which this forum does not allow. I also deleted the default virtual device called MyAvd0.
I then tried “cordova emulate android” and after a VERY long time (more than 5 minutes for sure) I finally saw the OS and then after more waiting the basic app with the Cordova icon being emulated.
Is there any way at all to accelerate the emulation speed? Does setting the memory of a virtual device need to be set to 2 GB’s, does this size also serve to slow down the emulation? Any emulation tips are appreciated!
On the other hand running it direct on my Note II work quite well. Hopefully, when working in Iconic the app will refresh itself automatically whenever changes are make!
Just commenting in case search brings another user here: I was getting the same ‘adb not found’ error when I tried to build the Ionic seed app for Android. I couldn’t work it out, because I’ve been building Phonegap Android apps with no problem with my existing export PATH. But updating it according to the pattern above, and double-checking every character in the string, fixed the problem and I am now able to build & emulate.
Don’t know why my previous PATH worked for Phonegap but not Ionic/Cordova, but glad to have worked it out without too many hours down the hole.
[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.]
ERROR building one of the platforms: Error: /home/sandim/projects/soucgApp/platforms/android/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: /home/sandim/projects/soucgApp/platforms/android/cordova/build: Command failed with exit code 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:139:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)