Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PhoneGap/Cordova Android Development

UPDATE 1:

This was everything I did in the end:

sudo aptitude install -y python-software-properties python g++ make sudo add-apt-repository -y ppa:chris-lea/node.js sudo aptitude update sudo aptitude install nodejs sudo aptitude install npm sudo npm install -g cordova sudo npm install -g phonegap phonegap create my-app cd my-app export PATH=${PATH}:/home/oshirowanen/Downloads/adt-bundle-linux-x86_64-20131030/sdk/platform-tools:/home/oshirowanen/Downloads/adt-bundle-linux-x86_64-20131030/sdk/tools sudo aptitude install ant cordova platform add android android create avd --name my_and --target 1 phonegap run android 

Was any of that not neccessary?


ORIGINAL QUESTION:

On my Ubuntu 12.04 computer, I've just installed node.js with npm and cordova:

$ node -v v0.10.23  $ npm -v 1.3.17  $ cordova -v 3.3.0-0.1.1 

When I try to add android:

$ cordova platform add android 

I get the following output:

Creating android project...  /usr/lib/node_modules/cordova/node_modules/q/q.js:126                     throw e;                           ^ Error: An error occured during creation of android sub-project.   /home/oshirowanen/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:126                     throw e;                           ^ Error: An error occurred while listing Android targets     at /home/oshirowanen/.cordova/lib/android/cordova/3.3.0/bin/lib/check_reqs.js:87:29     at _rejected (/home/oshirowanen/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:808:24)     at /home/oshirowanen/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:834:30     at Promise.when (/home/oshirowanen/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:1079:31)     at Promise.promise.promiseDispatch (/home/oshirowanen/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:752:41)     at /home/oshirowanen/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:574:44     at flush (/home/oshirowanen/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:108:17)     at process._tickCallback (node.js:415:13)      at /usr/lib/node_modules/cordova/src/platform.js:244:30     at ChildProcess.exithandler (child_process.js:641:7)     at ChildProcess.EventEmitter.emit (events.js:98:17)     at maybeClose (child_process.js:735:16)     at Socket.<anonymous> (child_process.js:948:11)     at Socket.EventEmitter.emit (events.js:95:17)     at Pipe.close (net.js:466:12) 

Anyone know why this is happening and how to resolve it?

I get the same issue with PhoneGap.

like image 458
oshirowanen Avatar asked Dec 13 '13 21:12

oshirowanen


People also ask

What is difference between Cordova and PhoneGap?

Cordova is owned by Apache and will always remain open source and free to use. However, PhoneGap is the distribution of Cordova and may even charge for the additional services. PhoneGap is the proprietary product of Adobe and the framework's future is in the hands of Adobe.

Is Cordova outdated?

Apache Cordova Is Retired: Alternatives for Cross Platform Mobile Development in 2022. Future trends of cross-platform mobile development are already starting to emerge, and it appears that Apache Cordova won't be included in the list of frameworks that power hybrid web apps for mobile devices.

Does Cordova need Android studio?

Cordova-Android requires the Android SDK, which can be installed on either macOS, Linux, or Windows. For the base system requirements, see the Android Studio's System Requirements.

What is Cordova mobile development?

Cordova is an open source framework that lets you convert HTML, JavaScript, and Cascading Style Sheets (CSS) into a native application that can run on iOS, Android, and other mobile platforms.


1 Answers

It's possible that the Android tools binaries are not in your path.

According to the PhoneGap docs (http://docs.phonegap.com/en/2.9.0/guide_getting-started_android_index.md.html), you need to include the Android SDK's tools and platform-tools in your PATH environment variable.

export PATH=${PATH}:/Development/adt-bundle/sdk/platform-tools:/Development/adt-bundle/sdk/tools

where Development is the path you installed your SDK.

like image 124
TomL Avatar answered Sep 21 '22 07:09

TomL