Java 新PhoneGap 3.0 无法解析import org.apache.cordova
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18097370/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
New PhoneGap 3.0 The import org.apache.cordova cannot be resolved
提问by grmmph
I'm installing the new phone gap 3.0 with the all-mighty command line.
我正在使用全能命令行安装新的手机间隙 3.0。
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
:
当我在 Eclipse 中打开 android 项目时,出现以下错误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.
我想我缺少一个库,但是如果认为安装 3.0 的唯一方法是命令行,我该如何解决这个问题。
采纳答案by David Rust-Smith
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/
更新:如果您升级到 Phonegap 3.3,则不再需要这样做。更新Phonegap详情:http://phonegap.com/blog/2013/12/13/phonegap-release/
Note:Make sure in eclipse you import Existing Android Code into WorkspaceNOT 'Existing Projects into Workspace
注意:确保在 eclipse 中将Existing Android Code 导入 Workspace 而不是“Existing Projects into Workspace
I had the exact same problem and found a solution that works:
我遇到了完全相同的问题,并找到了一个有效的解决方案:
- Download the source ZIP for Cordova: http://cordova.apache.org/#download
- Extract the 'cordova-android' ZIP anywhere. Inside will be a 'framework' folder.
- In eclipse open the newly unzipped 'cordova-android/framework' folder as an existing project.
- In eclipse right click on this new 'Cordova' project -> Properties -> Android. Make sure 'Is Library' is checked.
- Right click on your app's project -> Properties -> Android. In the Library section choose 'Add'. Select your Cordova project.
- 下载 Cordova 的源 ZIP:http: //cordova.apache.org/#download
- 在任何地方提取“cordova-android”ZIP。里面将是一个“框架”文件夹。
- 在 Eclipse 中,将新解压的“cordova-android/framework”文件夹作为现有项目打开。
- 在 Eclipse 中右键单击这个新的“Cordova” 项目 -> 属性 -> Android。确保选中“是库”。
- 右键单击您应用的项目 -> 属性 -> Android。在库部分选择“添加”。选择您的 Cordova 项目。
All done, import should now resolve!
全部完成,导入现在应该解决了!