10

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.

1 Answer 1

17

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!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.