Cordova ant jar not available

11,632

Solution 1

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.

Solution 2

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

Solution 3

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.

Solution 4

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.

Share:
11,632
nimbusgb
Author by

nimbusgb

Updated on June 04, 2022

Comments

  • nimbusgb
    nimbusgb almost 2 years

    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?

  • nimbusgb
    nimbusgb over 10 years
    I have imported both projects into ADT but the HelloWorld app still has compile errors. The import org.apache.cordova.* fails which is odd because the source is all there in the project under CordovaLib
  • MBillau
    MBillau over 10 years
    You need to import the projects into Eclipse, not ADT. When you right click on the Hello project, and click Properties, then click "Android"...on the bottom under the Library section you should see "CordovaLib" and it should be checked...is it? (I don't use Eclipse that much but I'm pretty sure you just have to get it configured correctly.) Another thing you can try is making sure that under the "Android" menu, that you have Android 4.4 checked as a Build Target.
  • nimbusgb
    nimbusgb over 10 years
    So the Eclipse based Android Development IDE is no good? That seems odd.
  • nimbusgb
    nimbusgb over 10 years
    Have tried this with pure eclipse IDE and it still will not build. somewhat frustrating. Been trying to get this lot going for 2 weeks on and off!
  • nimbusgb
    nimbusgb over 10 years
    Although the HelloWorld-CordovaLibs is checked as per your suggestion and the build target is 4.4 I had errors on the HelloWorld project until I did an initial clean on the HelloWorld-CordovaLibs project.
  • MBillau
    MBillau over 10 years
    I guess I'm confused about what you mean by ADT - I use Eclipse with the ADT tools installed, I think I downloaded it as a single package from the android website. I thought you were talking about something else though. No, you need to use the Eclipse based tool. So you are saying that you cleaned the Libs project and now everything works fine?
  • nimbusgb
    nimbusgb over 10 years
    Nope ADT is a single eclipse download. It's eclipse but branded as ADT.
  • nimbusgb
    nimbusgb over 10 years
    Downloaded from dl.google.com/android/adt/adt-bundle-windows-x86_64-20131310‌​.zip .... should end up being the same thing with all the SDK's and ADT installed. ......... Moved everything to original 'Eclipse' unbranded installation and yes it all works. Reproduced a new project and imported it into the 'ADT' version and that works too. Needed the initial build to 'kick it off'. @MBillau
  • casper123
    casper123 almost 10 years
    you're a life saver :))))