Vinod
Vinod

Reputation: 2311

Cordova jar is missing in phonegap 3.5.0

Before I am using phonegap 2.7.0. so for phonegap update, I have installed the phonegap version 3.5.0 using node.js, but in the phonegap folder there is no cordova jar file. If I create a project in ADT how can I add cordova.jar and cordova.js? I am unable to see any jar file in phonegap folder. Even If I create a project from command prompt I did not see any phonegap jar file and js file in my created project.

Can any one help me how to create and run my first project using phonegap 3.5.0?

Upvotes: 7

Views: 14548

Answers (4)

Bikey
Bikey

Reputation: 945

I moved the src files from C:..{DownloadFolder}\cordova-android-3.5.1\cordova-android\framework\src\ to the src folder in Eclipse and added it to the Build path (Right Click and select Add to build path).

Upvotes: 0

Robi Sen
Robi Sen

Reputation: 162

What worked for me is

"Once the Eclipse window opens, a red X may appear to indicate unresolved problems. If so, follow these additional steps:

Right-click on the project directory.

In the resulting Properties dialog, select Android from the navigation pane.

For the project build target, select the highest Android API level you have installed.

Click OK.

Select Clean from the Project menu. This should correct all the errors in the project." from

http://cordova.apache.org/docs/en/3.5.0/guide_platforms_android_index.md.html#Android%20Platform%20Guide

Upvotes: 3

Evilripper
Evilripper

Reputation: 1185

I have the same problem... I tryed to create a new project with [email protected]:

cordova -d create BarcodeTest it.test.BarcodeTest BarcodeTest
cd BarcodeTest
cordova platform add android
cordova build

I opened the project by eclipse and it was full of errors!! :-(

I fixed manually the problem, but Cordova-3.5.0.jar is missing!!

  1. Right click on the project and go to "Properties"
  2. Select "Java Build Path" on the left
  3. Open "Source" tab
  4. Click "Add Folder..." and check "gen" and "src"

I resolved the Cordova-3.5.0.jar missing problem in this way:

  1. Download https://www.apache.org/dist/cordova/platforms/cordova-android-3.5.0.zip
  2. There are two eclipse project CordovaViewTestActivity and Conrdova. Open the library Cordova with eclipse
  3. Build and generate in Bin/Cordova.jar
  4. Right click on your app's broken project -> Properties -> Android. In the Library tab choose 'Add'. Select Cordova project with cordova.jar

But my project goes in exception when I launch it!!! I think to return to old version of cordova.

I found another solution to generate jar from official documentation http://cordova.apache.org/docs/en/3.5.0/guide_platforms_android_webview.md.html

Navigate to the Android package's /framework directory and run ant jar. It creates the Cordova .jar file, formed as /framework/cordova-3.5.0.jar.

Ok it works

C:\LTPReleaseAndroid\cordova-android\framework>android update project -p .
Updated local.properties
build.xml: Found version-tag: custom. File will not be updated.
Added file C:\LTPReleaseAndroid\cordova-android\framework\proguard-project.txt

C:\LTPReleaseAndroid\cordova-android\framework>ant jar
Buildfile: C:\LTPReleaseAndroid\cordova-android\framework\build.xml

-pre-build:

-check-env:
 [checkenv] Android SDK Tools Revision 22.3.0
 [checkenv] Installed at C:\Programmi\adt-bundle-windows-x86\sdk

-setup:
     [echo] Project Name: Cordova
  [gettype] Project Type: Android Library

-build-setup:
[getbuildtools] Using latest Build Tools: 18.1.0
     [echo] Resolving Build Target for Cordova...
[gettarget] Project Target:   Android 4.4
[gettarget] API level:        19
     [echo] ----------
     [echo] Creating output directories if needed...
    [mkdir] Created dir: C:\LTPReleaseAndroid\cordova-android\framework\libs
    [mkdir] Created dir: C:\LTPReleaseAndroid\cordova-android\framework\bin
    [mkdir] Created dir: C:\LTPReleaseAndroid\cordova-android\framework\bin\res
    [mkdir] Created dir: C:\LTPReleaseAndroid\cordova-android\framework\bin\rsOb
j
    [mkdir] Created dir: C:\LTPReleaseAndroid\cordova-android\framework\bin\rsLi
bs
    [mkdir] Created dir: C:\LTPReleaseAndroid\cordova-android\framework\gen
    [mkdir] Created dir: C:\LTPReleaseAndroid\cordova-android\framework\bin\clas
ses
    [mkdir] Created dir: C:\LTPReleaseAndroid\cordova-android\framework\bin\dexe
dLibs
     [echo] ----------
     [echo] Resolving Dependencies for Cordova...
[dependency] Library dependencies:
[dependency] No Libraries
[dependency]
[dependency] ------------------
     [echo] ----------
     [echo] Building Libraries with '${build.target}'...
   [subant] No sub-builds to iterate on

-code-gen:
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
     [echo] Handling aidl files...
     [aidl] No AIDL files to compile.
     [echo] ----------
     [echo] Handling RenderScript files...
     [echo] ----------
     [echo] Handling Resources...
     [aapt] Generating resource IDs...
     [echo] ----------
     [echo] Handling BuildConfig class...
[buildconfig] Generating BuildConfig class.

-pre-compile:

-compile:
    [javac] Compiling 90 source files to C:\LTPReleaseAndroid\cordova-android\fr
amework\bin\classes
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
     [echo] Creating library output jar file...
      [jar] Building jar: C:\LTPReleaseAndroid\cordova-android\framework\bin\cla
sses.jar

jar:
      [jar] Building jar: C:\LTPReleaseAndroid\cordova-android\framework\cordova
-3.5.0.jar

BUILD SUCCESSFUL
Total time: 4 seconds

Upvotes: 4

Dick van den Brink
Dick van den Brink

Reputation: 14529

cordova.js is copied automatically by cordova on build and the the cordova.jar is now a project reference (CordovaLib).

To setup everything you need to call "cordova build android" (assuming you already have your project) on the commandline. It will copy all the contents from "www" to platforms/android/assets/www folder.

You might need to run the following from the command line first, but not really sure:

android update project --path

You might want to take a look at the Android platform guide found here: http://cordova.apache.org/docs/en/3.5.0/guide_platforms_android_index.md.html#Android%20Platform%20Guide

btw, you can find cordova.js in platforms/android/platform_www and the source for Cordova lib in platforms/android/CordovaLib.

Upvotes: 0

Related Questions