Running Cordova HelloWorld project on Ubuntu - android

I've worked with Apache Cordova quite a bit on Windows but for some reason I can't get the project to run on Ubuntu.
I've setup the Android SDK correctly so adb and android both run from Terminal.
Here's the output I get when attempting to run the project on android.
josh#josh-ubuntu:~/Projects/hello$ cordova run android
Running command: /home/josh/Projects/hello/platforms/android/cordova/run
/home/josh/Projects/hello/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error: EACCES, permission denied '/usr/local/bin/android-sdk-linux/tools/lib/build.template'
at Object.fs.openSync (fs.js:438:18)
at Object.fs.readFileSync (fs.js:289:15)
at /home/josh/Projects/hello/platforms/android/cordova/lib/build.js:120:40
at _fulfilled (/home/josh/Projects/hello/platforms/android/cordova/node_modules/q/q.js:798:54)
at self.promiseDispatch.done (/home/josh/Projects/hello/platforms/android/cordova/node_modules/q/q.js:827:30)
at Promise.promise.promiseDispatch (/home/josh/Projects/hello/platforms/android/cordova/node_modules/q/q.js:760:13)
at /home/josh/Projects/hello/platforms/android/cordova/node_modules/q/q.js:574:44
at flush (/home/josh/Projects/hello/platforms/android/cordova/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:419:13)
Error: /home/josh/Projects/hello/platforms/android/cordova/run: Command failed with exit code 8
at ChildProcess.whenDone (/usr/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)
Could it be something wrong with my file permissions?

The log is saying that is a Permissions Problem!
Try to execute
sudo cordova run android
and if it lets you, then for sure it's a permission issue!

Related

Difficulty getting ionic emulate android to work

I have been successfully emulating my ionic project with ios but am unable to get it to come up on the Android emulator on my Mac. I get the following error from ionic:
/Users/billnoble/documents/cues/code/current/Cues-App/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Target 'WQVGA400' not found, unable to run project
Error: /Users/billnoble/documents/cues/code/current/Cues-App/platforms/android/cordova/run: Command failed with exit code 1
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)
I have the Android SDK installed and skins installed in the library/android/sdk/platforms/android-22/skins directory. I have checked that the WQVGA400 skin is in there.
The ionic command I am issuing is:
ionic emulate android --target="WQVGA400"
Am I missing a step?

Cordova - android error when building

This is my first experience in cordova. I created the helloworld project and installed the android platform correctly. When I tried to build the project by cordova build android, it shows this error message.
Running command: /home/menaka/hello/platforms/android/cordova/build
[Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.]
ERROR building one of the platforms: Error: /home/menaka/hello/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/menaka/hello/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:131:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)
But I have successfully set the ANDROID_HOME variable and PATH.
menaka#menaka-X550LC:~/hello$ echo $ANDROID_HOME
/Extra/Softwares/Android/Sdk/
So, what would be the reason for this?

ionic emulate android not working

I am trying to create a blank project using ionic framework. But I'm getting the following error when I run the ionic emulate android command.
Error executing "adb devices": /bin/sh: 1: adb: not found
Error: /home/username/todo/platforms/android/cordova/run: Command failed with exit code 8
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)
I also have added android sdk path to .bashrc file.
export ANDROID_HOME="$HOME/username/android/eclipse/adt-bundle/sdk/tools"
export ANDROID_PLATFORM_TOOLS="$HOME/username/eclipse/adt-bundle/sdk/platform-tools"
export PATH="$ANDROID_HOME:$ANDROID_PLATFORM_TOOLS:$PATH"
I have also install the eclipse adt bundle for 64 bits. any kind of help would be appreciated.
Error executing "adb devices": /bin/sh: 1: adb: not found
Do you have adb in your path? If not, put it. It comes with android sdk

PhoneGap install on Mac

I'm getting a bit annoyed at this install. I've followed the instructions from here and I've got as far as adding Android as a platform, the large chunk of code is a copy and paste from my Terminal when I am trying to run it. I have Android SDK installed at ~/Development/sdk/ ~ is the home directory for the user
Donalds-MacBook-Air:hello donaldsutherland$ cordova platform add android
Creating android project...
/Users/donaldsutherland/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:126
throw e;
^
Error: The command "android" failed. Make sure you have the latest Android SDK installed, and the "android" command (inside the tools/ folder) is added to your path.
at /Users/donaldsutherland/.cordova/lib/android/cordova/3.4.0/bin/lib/check_reqs.js:85:29
at _rejected (/Users/donaldsutherland/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:808:24)
at /Users/donaldsutherland/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:834:30
at Promise.when (/Users/donaldsutherland/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:1079:31)
at Promise.promise.promiseDispatch (/Users/donaldsutherland/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:752:41)
at /Users/donaldsutherland/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:574:44
at flush (/Users/donaldsutherland/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:419:13)
Error: /Users/donaldsutherland/.cordova/lib/android/cordova/3.4.0/bin/create: Command failed with exit code 8
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/src/superspawn.js:126:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:753:16)
at Process.ChildProcess._handle.onexit (child_process.js:820:5)
Donalds-MacBook-Air:hello donaldsutherland$ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/your-path/android-sdk-linux/platform-tools:/your-path/android-sdk-linux/tools:/Development/android-sdk-linux/platform-tools:/Development/android-sdk-linux/tools:/Development/sdk/platform-tools:/Development/sdk/tools
Donalds-MacBook-Air:hello donaldsutherland$
If I run $ cordova platforms ls it lists Available platforms: amazon-fireos, android, blackberry10, firefoxos, ios
create a a profile file ~/.bash_profile
write this line to add the android SDK folder to your PATH
export PATH=${PATH}:~/Development/sdk/tools:~/Development/sdk/platform-tools
close the terminal and open it again, then it should recognize the "android" command everywhere

cordova phonegap - error installing on Android platform

I am new to Cordova and phonegap but have Android working on my ubuntu 12.04.
I followed this official guide and manage to install cordova.
Despite my machine supports android sdk, when I run this command:
cordova platform add android
I get the following exception:
*cordova platform add android
Creating android project...
/root/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:126
throw e;
^
Error: An error occurred while listing Android targets
at /root/.cordova/lib/android/cordova/3.4.0/bin/lib/check_reqs.js:87:29
at _rejected (/root/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:808:24)
at /root/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:834:30
at Promise.when (/root/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:1079:31)
at Promise.promise.promiseDispatch (/root/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:752:41)
at /root/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:574:44
at flush (/root/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:415:13)
Error: /root/.cordova/lib/android/cordova/3.4.0/bin/create: Command failed with exit code 8
at ChildProcess.whenDone (/usr/lib/node_modules/cordova/src/superspawn.js:112:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)
root#sergio-Aspire-5755G:/home/sergio/Development/HelloWorld# cordova platforms ls
Installed platforms:
Available platforms: android, blackberry10, firefoxos, ubuntu
root#xxx-Aspire-5755G:/home/sergio/Development/HelloWorld# cordova platform add android
Creating android project...
/root/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:126
throw e;
^
Error: An error occurred while listing Android targets
at /root/.cordova/lib/android/cordova/3.4.0/bin/lib/check_reqs.js:87:29
at _rejected (/root/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:808:24)
at /root/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:834:30
at Promise.when (/root/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:1079:31)
at Promise.promise.promiseDispatch (/root/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:752:41)
at /root/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:574:44
at flush (/root/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:415:13)
Error: /root/.cordova/lib/android/cordova/3.4.0/bin/create: Command failed with exit code 8
at ChildProcess.whenDone (/usr/lib/node_modules/cordova/src/superspawn.js:112:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)*
I tried and see other post like this but noone helped me.
Android sdk version 19 is installed
1) run "android avd" command and create at least one virtual device based on a version of a previously downloaded SDK.
2) sudo apt-get install ant1.8
worked for me.
You need to check if path to Android SDK is correct or not. Check your Environment Variables PATH, ANDROID_PLATFORM_TOOLS, ANDROID_HOME, ANT_HOME you can check if they are configured correctly by echo %ANDROID_HOME% check for all Paths you will know which path is not configured properly.
I solved this way:
adding the below line to my .bashrc:
export PATH=$PATH:/opt/adt-bundle-linux-x86_64-20131030/sdk/platform-tools:/opt/adt-bun‌​dle-linux-x86_64-20131030/sdk/tools

Categories

Resources