Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

New PhoneGap 3.0 The import org.apache.cordova cannot be resolved

I'm installing the new phone gap 3.0 with the all-mighty command line.

cordova create hello com.example.hello HelloWorld
cordova platform add android

When I open the android project in eclipse I get this error on HelloWorld.java:

The import org.apache.cordova cannot be resolved

I guess I have a missing library but how to I solve this if the only way to install 3.0 is thought the command line.

like image 427
grmmph Avatar asked Aug 07 '13 07:08

grmmph


1 Answers

Update: If you upgrade to Phonegap 3.3 you shouldn't need to do this anymore. Details on updating Phonegap: http://phonegap.com/blog/2013/12/13/phonegap-release/

Note: Make sure in eclipse you import Existing Android Code into Workspace NOT 'Existing Projects into Workspace

I had the exact same problem and found a solution that works:

  1. Download the source ZIP for Cordova: http://cordova.apache.org/#download
  2. Extract the 'cordova-android' ZIP anywhere. Inside will be a 'framework' folder.
  3. In eclipse open the newly unzipped 'cordova-android/framework' folder as an existing project.
  4. In eclipse right click on this new 'Cordova' project -> Properties -> Android . Make sure 'Is Library' is checked.
  5. Right click on your app's project -> Properties -> Android. In the Library section choose 'Add'. Select your Cordova project.

All done, import should now resolve!

like image 180
David Rust-Smith Avatar answered Oct 05 '22 10:10

David Rust-Smith