简体   繁体   English

PhoneGap + Cordova应用程序无法在AVD(Android虚拟设备)上运行

[英]PhoneGap+Cordova app is not working on AVD(Android Virtual Device)

I followed all the steps in the basic Phonegap tutorial (Eclipse, Android SDK, ADT Phonegap), 我按照基本的Phonegap教程(Eclipse,Android SDK,ADT Phonegap)中的所有步骤,

Step1: I created an HMTL page in the assets/www folder, ran it, and it showed my hello world html. Step1:我在assets / www文件夹中创建了一个HMTL页面,运行它,它显示了我的hello world html。

Step 2: I added a reference to jQuery Mobile on a CDN in my HTML page: it worked. 第2步:我在HTML页面的CDN上添加了对jQuery Mobile的引用:它工作正常。

Step 3: I edit index.html page, copy-pasted the code, which is a sample from the Phonegap site, and it does... nothing. 第3步:我编辑index.html页面,复制粘贴代码,这是来自Phonegap网站的一个示例,它确实......没有。 Not even an alert (I added some alerts to see if something happens, but even the onDeviceReady event doesn't fire. 甚至没有警报(我添加了一些警报,看看是否有事情发生,但即使是onDeviceReady事件也不会触发。

I have the Phonegap JAR in place, the cordova-1.7.0.js in my assest/www directory, but something is probably missing. 我有Phonegap JAR,我的assest / www目录中的cordova-1.7.0.js,但可能有些东西丢失了。

I also tried for Cordova JAR in libs folder, but it is not working. 我也在libs文件夹中尝试过Cordova JAR,但它无法正常工作。

Can someone help me out? 有人可以帮我吗?

I also tried another sample from the Phonegap site (the 'device properties', 'Accelerometer' sample code), but it still doesn't work. 我还尝试了Phonegap站点的另一个示例('设备属性','Accelerometer'示例代码),但它仍然无效。

It's a fresh Eclipse ADT(Android Development Tool), I've install the Android version to 4.0.3, 4.1.2, 4.2 from Android SDK and I'm using Phonegap 2.2.0. 这是一个全新的Eclipse ADT(Android开发工具),我已经从Android SDK安装Android版本到4.0.3,4.1.2,4.2,我正在使用Phonegap 2.2.0。

you need to put this xml file in www folder "config.xml" 你需要将这个xml文件放在www文件夹“config.xml”中

here link for xml https://build.phonegap.com/docs/config-xml 这里链接xml https://build.phonegap.com/docs/config-xml

Check the phonegap.js file resource. 检查phonegap.js文件资源。 you add the script element in the head element. 你在head元素中添加脚本元素。 you must the correct cordova-1.7.0.js 你必须正确的cordova-1.7.0.js

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM