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

匿名 (未验证) 提交于 2019-12-03 02:16:02

问题:

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:

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!



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!