Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
682 views
in Technique[技术] by (71.8m points)

cordova - PhoneGap sample application for android does not work

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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Likely the name of phonegapjs or cordovajs 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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...