为Android不起作用PhoneGap的示例应用程序 [英] PhoneGap sample application for android does not work

查看:106
本文介绍了为Android不起作用PhoneGap的示例应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想学习使用PhoneGap的针对Android平台的移动应用程序的开发。所以,我下载了最新版本的PhoneGap 1.6。我发现了一个不错的文章在 http://wiki.phonegap.com / W /页/ 30862722 / PhoneGap的,Android的Eclipse的快速启动它展示了如何设置的PhoneGap的Eclipse插件。将示例应用程序在Eclipse后,我现在能够运行的应用程序,但是,没有列表中的项目似乎没有工作对我的模拟器,也没有我的电话。示例应用程序包含一个列表(如图中的链接例),即获取位置,蜂鸣声,振动,呼叫411,拍照等。只有拨打411是工作有什么不对的code或PhoneGap的?

logcat的

 五月四日至一十九号:45:01.538:I / CordovaLog(325):更改日志级别为DEBUG(3)
5月4号至19日:45:01.538:D / DroidGap(325):DroidGap.onCreate()
5月4号至19日:45:01.559:D / DroidGap(325):DroidGap.loadUrl(文件:///android_asset/www/index.html)
5月4号至19日:45:01.559:D / DroidGap(325):DroidGap:URL =文件:///android_asset/www/index.html的baseUrl =文件:/// android_asset / WWW /
5月4号至19日:45:01.958:D / DroidGap(325):DroidGap.init()
5月4号至19日:45:02.078:D /插件管理(325):的init()
5月4号至19日:45:02.178:D / SoftKeyboardDetect(325):忽略此事件
5月4号至19日:45:02.358:D / SoftKeyboardDetect(325):忽略此事件
5月4号至19日:45:10.470:D / CordovaLog(325):类型错误:对前pression'navigator.notification'结果[未定义]是不是一个对象。
5月4号至19日:45:10.470:D / CordovaLog(325):文件:///android_asset/www/main.js:第21行:类型错误:对前pression'navigator.notification'结果[未定义]是不是对象。
5月4号至19日:45:10.499:E / Web控制台(325):类型错误:对前pression'navigator.notification'结果[未定义]是不是一个对象。在文件:///android_asset/www/main.js:21
5月4号至19日:45:15.108:I /数据库(325):源码返回:错误code = 14,味精=无法打开文件的源代码行25467
5月4号至19日:45:21.128:D / CordovaLog(325):类型错误:对前pression'navigator.notification'结果[未定义]是不是一个对象。
5月4号至19日:45:21.128:D / CordovaLog(325):文件:///android_asset/www/main.js:第25行:类型错误:对前pression'navigator.notification'结果[未定义]是不是对象。
5月4号至19日:45:21.128:E / Web控制台(325):类型错误:对前pression'navigator.notification'结果[未定义]是不是一个对象。在文件:///android_asset/www/main.js:25
5月4号至19日:45:22.908:W / KeyCharacterMap(325):没有键盘ID 0
5月4号至19日:45:22.908:W / KeyCharacterMap(325):使用默认的键盘对应:/system/usr/keychars/qwerty.kcm.bin
5月4号至19日:45:26.228:D / CordovaLog(325):类型错误:对前pression'navigator.network'结果[未定义]是不是一个对象。
5月4号至19日:45:26.228:D / CordovaLog(325):文件:///android_asset/www/main.js:行108:类型错误:对前pression'navigator.network'结果[未定义]是不是对象。
5月4号至19日:45:26.249:E / Web控制台(325):类型错误:对前pression'navigator.network'结果[未定义]是不是一个对象。在文件:///android_asset/www/main.js:108
 

解决方案

PhoneGap的可能的名称*在你的index.html JS或科尔多瓦* JS不会在文件名中的资产/ www目录相匹配。

在鼓掌Eclipse插件我创建,提供了一个向导来配置PhoneGap的项目为Android。请参阅<一href="http://wiki.phonegap.com/w/page/34483744/PhoneGap-Eclipse-PlugIn-for-Android">http://wiki.phonegap.com/w/page/34483744/PhoneGap-Eclipse-PlugIn-for-Android

I am trying to learn Mobile app development using Phonegap for Android platform. So, I downloaded latest PhoneGap version 1.6. I found a nice article at http://wiki.phonegap.com/w/page/30862722/phonegap-android-eclipse-quickstart which shows how to set up PhoneGap for Eclipse. After adding sample application in Eclipse i am now able to run the application but, None of the list items seems to be working neither on my emulator nor on my phone. The sample application contains a list(As shown in the link Example) i.e Get Location,Beep,Vibrate,Call 411,Take a Picture,etc. Only call 411 is working what's wrong with the code or phonegap?

logcat

04-19 05:45:01.538: I/CordovaLog(325): Changing log level to DEBUG(3)
04-19 05:45:01.538: D/DroidGap(325): DroidGap.onCreate()
04-19 05:45:01.559: D/DroidGap(325): DroidGap.loadUrl(file:///android_asset/www/index.html)
04-19 05:45:01.559: D/DroidGap(325): DroidGap: url=file:///android_asset/www/index.html baseUrl=file:///android_asset/www/
04-19 05:45:01.958: D/DroidGap(325): DroidGap.init()
04-19 05:45:02.078: D/PluginManager(325): init()
04-19 05:45:02.178: D/SoftKeyboardDetect(325): Ignore this event
04-19 05:45:02.358: D/SoftKeyboardDetect(325): Ignore this event
04-19 05:45:10.470: D/CordovaLog(325): TypeError: Result of expression 'navigator.notification' [undefined] is not an object.
04-19 05:45:10.470: D/CordovaLog(325): file:///android_asset/www/main.js: Line 21 : TypeError: Result of expression 'navigator.notification' [undefined] is not an object.
04-19 05:45:10.499: E/Web Console(325): TypeError: Result of expression 'navigator.notification' [undefined] is not an object. at file:///android_asset/www/main.js:21
04-19 05:45:15.108: I/Database(325): sqlite returned: error code = 14, msg = cannot open file at source line 25467
04-19 05:45:21.128: D/CordovaLog(325): TypeError: Result of expression 'navigator.notification' [undefined] is not an object.
04-19 05:45:21.128: D/CordovaLog(325): file:///android_asset/www/main.js: Line 25 : TypeError: Result of expression 'navigator.notification' [undefined] is not an object.
04-19 05:45:21.128: E/Web Console(325): TypeError: Result of expression 'navigator.notification' [undefined] is not an object. at file:///android_asset/www/main.js:25
04-19 05:45:22.908: W/KeyCharacterMap(325): No keyboard for id 0
04-19 05:45:22.908: W/KeyCharacterMap(325): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
04-19 05:45:26.228: D/CordovaLog(325): TypeError: Result of expression 'navigator.network' [undefined] is not an object.
04-19 05:45:26.228: D/CordovaLog(325): file:///android_asset/www/main.js: Line 108 : TypeError: Result of expression 'navigator.network' [undefined] is not an object.
04-19 05:45:26.249: E/Web Console(325): TypeError: Result of expression 'navigator.network' [undefined] is not an object. at file:///android_asset/www/main.js:108

解决方案

Likely the name of phonegap*js or cordova*js in your index.html does not match the file name in the assets/www directory.

The AppLaud Eclipse plugin that I created, provides a wizard to configure projects for PhoneGap for Android. See http://wiki.phonegap.com/w/page/34483744/PhoneGap-Eclipse-PlugIn-for-Android

这篇关于为Android不起作用PhoneGap的示例应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆