Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

create script in Cordova fails with unexpected error in Ubuntu 12.10

On Ubuntu 12.10, I am trying to set up cordova 2.3.0(PhoneGap) based on the instructions present here http://docs.phonegap.com/en/2.3.0/guide_getting-started_android_index.md.html#Getting%20Started%20with%20Android.

but when I run the script I get the following error:

An unexpected error occurred: [ ! -e "$BUILD_PATH"/framework/libs/commons-codec-1.7.jar ]  
exited with 1
Deleting project...

I looked up the commons-codec-1.7.jar and it is present where it should be:

-rw-r--r-- 1 user user 259600 Jan 21 15:32 framework/libs/commons-codec-1.7.jar

I tried hard coding the path and I still get the same error.so why am I seeing this error.

Any ideas what could be wrong or missing here?

thanks ahead

like image 890
picstand Avatar asked Jan 22 '13 00:01

picstand


3 Answers

This is most likely because Java and/or Apache Ant is not installed properly. I had the same issue until I installed the Oracle JDK and Ant with the following commands:

sudo apt-add-repository ppa:webupd8team/java
sudo apt-get update && sudo apt-get install oracle-java6-installer
sudo apt-get install ant
like image 117
Tom Spencer Avatar answered Oct 20 '22 22:10

Tom Spencer


I recommend to make create script output more verbose to research build problems. So you can edit this line:

(cd "$BUILD_PATH"/framework && ant jar &> /dev/null )

to

(cd "$BUILD_PATH"/framework && ant jar )

This helps me to determine my problem:

makk@localhost:~/projects/eclipse/cordova-android/bin$ ./create ~/projects/eclipse/plackarta com.MyApp MyApp
Buildfile: build.xml

BUILD FAILED
/home/makk/projects/eclipse/cordova-android/framework/build.xml:33: The required minimum version of ant is 1.8.0, you have Apache Ant version 1.7.1 compiled on September 8 2010

Total time: 0 seconds

You can fix this depending on your OS. On modern systems you'll probably get luck following fiznool answer. Also you can try this solution (on your own risk!): https://askubuntu.com/questions/55488/install-upgrade-to-apache-ant-1-8-2. There are also ready-to-use binaries on http://ant.apache.org/bindownload.cgi (helped me with my old 10.04 Ubuntu).

like image 6
sunki Avatar answered Oct 20 '22 22:10

sunki


I've had this exact same problem, I'm not sure what solved it in the end but here's a list of what I did.

  • Reinstalled the android sdk
  • Installed ADT for eclipse (since I don't use eclipse I didn't install it initially)
  • On the SDK manager I installed the extras and API's 14~17

I should have tried to run the command after each step to pinpoint the problem. If you find out exactly what solved it please tell.

like image 2
castilho Avatar answered Oct 20 '22 22:10

castilho