Anshad Vattapoyil
Anshad Vattapoyil

Reputation: 23463

Cordova add platform error in Ubuntu

I have the android latest sdk tools in my Ubuntu 13.10 x64 Documents folder.The eclipse and sdk are working fine,also created one virtual device.

cd Documents
cd adt-bundle-linux-x86_64-20130514/
cd sdk/
ls -l

It gives me these,

add-ons
build-tools
docs
extras
platforms
platform-tools
samples
sources
system-images
temp
tools

Now installed ant using sudo apt-get install ant

Then edited path,

gedit ~/.bashrc

And added this code at end,

#AndroidDev PATH
export PATH=${PATH}:~/Documents/adt-bundle-linux-x86_64-20130514/sdk/tools
export PATH=${PATH}:~/Documents/adt-bundle-linux-x86_64-20130514/sdk/platform-tools 

Now when I tried to add android platform to sample project, it throws error,

cd hello
cordova platform add android

The error,

Creating android project...

/home/######/.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 /home/######/.cordova/lib/android/cordova/3.4.0/bin/lib/check_reqs.js:87:29
    at _rejected (/home/######/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:808:24)
    at /home/######/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:834:30
    at Promise.when (/home/######/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:1079:31)
    at Promise.promise.promiseDispatch (/home/######/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:752:41)
    at /home/######/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:574:44
    at flush (/home/######/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:108:17)
    at process._tickCallback (node.js:415:13)
Error: /home/######/.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)

Upvotes: 0

Views: 3998

Answers (1)

grattepoil
grattepoil

Reputation: 46

I found a solution for the same problem. I don't know what is exactly the solution but i solved it as it :

  1. I restart from scratch. Backup my project folder in myproject.bak folder and

    launch phonegap create myproject

  2. cd myproject

  3. cordova platform add android

  4. I copied my project resources from myproject.bak into my new myproject

  5. grunt phonegap:build:android

At this time i have already an error because of a file with accent in my projet. I found this error with the following command :

ant debug -f "/home/grattepoil/path/to/my/project/platforms/android/build.xml" -Dout.dir=ant-build -Dgen.absolute.dir=ant-gen -logfile log-ant.txt

Upvotes: 3

Related Questions