Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova ant jar not available

Cordova 3.3.0 installed from fresh and PATH fixed with visibility to tools etc.

Build a new bare application Add android platform

now it starts to go awry -

Following instructions to import to Android Development Tools ( Eclipse ) I get TWO projects created HelloWorld and HelloWorld-CordovaLib

HelloWorld has errors as it can't see/does not have the the cordova.jar file ( assuming this from past experience )

HelloWorld-CordovaLibs is whats missing from the HelloWorld project all the source to Cordova

Assuming that I need the jar file I dig around and try running ant jar from within the android part of my project

Running ant jar fails -

Target "jar" does no exist in the project "HelloWorld"

which is an ant error telling me it doesn't know how to build target jar.

look at build.xml in the android directory confirms this - no section on "jar" A bit more digging on the net and the Apache Cordova git repository seems to intimate that I should have another file build.xml inside a directory 'framework' with the jar target defined.

Ahhhhh - no framework directory anywhere.

Can anyone work out where this is all going wrong before I tear any more hair out?

like image 347
nimbusgb Avatar asked Dec 18 '13 13:12

nimbusgb


4 Answers

I followed this guide to create a Cordova 3.3.0 project, import it into Eclipse, and successfully run it on a device from Eclispe: http://cordova.apache.org/docs/en/3.3.0/guide_platforms_android_index.md.html#Android%20Platform%20Guide

You are right that it imports "HelloWorld" and "HelloWorld-CordovaLibs". This is because of https://issues.apache.org/jira/browse/CB-5232, which makes Android now use the CordovaLib instead of the .jar for a variety of reasons (see the bug report.) You should import both projects into Eclipse (I'll change this in the documentation).

If you follow that guide you should be fine. You don't have to build a .jar anymore.

like image 152
MBillau Avatar answered Nov 15 '22 13:11

MBillau


steps

1- after create the project i import both "hello" and "hello-cordovaLib"

2- i remove the reference to "hello-cordovaLib" from "hello"

3- build the "hello-cordovaLib"

4- restore the reference to "hello-cordovaLib" from "hello"

5- clean "hello" and run

like image 35
hosumayok Avatar answered Nov 15 '22 14:11

hosumayok


In short .... The ide ( either eclipse or ADT ) needed the initial build of the sub project to allow the HelloWorld project to 'see' the HelloWorld-cordovaLibs project.

like image 2
nimbusgb Avatar answered Nov 15 '22 14:11

nimbusgb


What solved my problem on HelloWorld project in my ADT is :

  1. I cleaned both the HelloWorld and the HelloWorld-cordovaLib.
  2. Right clicked on HelloWorld-cordovaLib ->properties->Android and verified it the isLibrary is checked.
  3. I right clicked on HelloWorld proj -> Properties ->Android -> The "is Library part" had Cordova with red check on it then I clicked on "Add" button and again added Cordova to the project which came with "green check" and then removed the red checked cordova.

Cleaned the projects and now its working fine.

like image 1
Swapnil Mhaske Avatar answered Nov 15 '22 14:11

Swapnil Mhaske