安装可以看这个教程:
http://docs.phonegap.com/en/3.0.0/guide_platforms_android_index.md.html#Android%20Platform%20Guide
或:
连个都差不多。
这里提出几个要注意的事项:
1. 在项目中要引入cordova.jar 包,这个包在Phonegap中是有的,但在cordova中没有,要在源码下编译生成,然后再引入到项目中。
2. 教程上有
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 folder.
- 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.
我的碰到的情况是,AndroidManifest.xml中找不到 @string/app_name 这个资源。 这个可以直接新建 res/valus/sring.xml 文件,添加如下内容:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Hello</string>
</resources>
这样,这个错误就没有了。
3. 编译运行后在模拟器和手机上运行还是不行,老出错。这是因为生成apk包的时候,没有把cordova.ja包打进去。解决方法:
Project=》Properties=》Java Build Path, Order and Export,选中库cordova-x-x-x.java包,这样包就可以输出到apk中了。