Не может загрузить пример HelloWorld в Android-телефоне

Я новичок в PhoneGap, и я использую его для Android. Я следую пошаговым инструкциям HelloPhoneGap с http://phonegap.com/start/#android. сначала запускайте его, он работает нормально, но позже, когда я запустил его, я получил эту ошибку:

LogCat:

03-21 09:52:02.467: D/dalvikvm(534): Not late-enabling CheckJNI (already on)
03-21 09:52:04.738: W/System.err(534): =====================================================================================
03-21 09:52:04.738: W/System.err(534): ERROR: plugin.xml is missing. Add res/xml/plugins.xml to your project.
03-21 09:52:04.738: W/System.err(534): https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-android.git;a=blob;f=framework/res/xml/plugins.xml
03-21 09:52:04.738: W/System.err(534): =====================================================================================
03-21 09:52:04.738: W/ResourceType(534): No package identifier when getting value for resource number 0x00000000
03-21 09:52:04.748: D/AndroidRuntime(534): Shutting down VM
03-21 09:52:04.748: W/dalvikvm(534): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
03-21 09:52:04.758: W/System.err(534): java.net.SocketException: socket failed: EACCES (Permission denied)
03-21 09:52:04.768: W/System.err(534): at libcore.io.IoBridge.socket(IoBridge.java:573)
03-21 09:52:04.768: W/System.err(534): at java.net.PlainSocketImpl.create(PlainSocketImpl.java:201)
03-21 09:52:04.768: W/System.err(534): at java.net.PlainServerSocketImpl.create(PlainServerSocketImpl.java:38)
03-21 09:52:04.778: W/System.err(534): at java.net.ServerSocket.<init>(ServerSocket.java:98)
03-21 09:52:04.788: W/System.err(534): at java.net.ServerSocket.<init>(ServerSocket.java:69)
03-21 09:52:04.788: W/System.err(534): at org.apache.cordova.CallbackServer.run(CallbackServer.java:208)
03-21 09:52:04.788: W/System.err(534): at java.lang.Thread.run(Thread.java:856)
03-21 09:52:04.788: W/System.err(534): Caused by: libcore.io.ErrnoException: socket failed: EACCES (Permission denied)
03-21 09:52:04.788: W/System.err(534): at libcore.io.Posix.socket(Native Method)
03-21 09:52:04.788: W/System.err(534): at libcore.io.BlockGuardOs.socket(BlockGuardOs.java:181)
03-21 09:52:04.788: W/System.err(534): at libcore.io.IoBridge.socket(IoBridge.java:558)
03-21 09:52:04.788: W/System.err(534): ... 6 more
03-21 09:52:04.817: E/AndroidRuntime(534): FATAL EXCEPTION: main
03-21 09:52:04.817: E/AndroidRuntime(534): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.phonegap.helloworld/com.phonegap.helloworld.app}: android.content.res.Resources$NotFoundException: Resource ID #0x0
03-21 09:52:04.817: E/AndroidRuntime(534): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
03-21 09:52:04.817: E/AndroidRuntime(534): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
03-21 09:52:04.817: E/AndroidRuntime(534): at android.app.ActivityThread.access$600(ActivityThread.java:123)
03-21 09:52:04.817: E/AndroidRuntime(534): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
03-21 09:52:04.817: E/AndroidRuntime(534): at android.os.Handler.dispatchMessage(Handler.java:99)
03-21 09:52:04.817: E/AndroidRuntime(534): at android.os.Looper.loop(Looper.java:137)
03-21 09:52:04.817: E/AndroidRuntime(534): at android.app.ActivityThread.main(ActivityThread.java:4424)
03-21 09:52:04.817: E/AndroidRuntime(534): at java.lang.reflect.Method.invokeNative(Native Method)
03-21 09:52:04.817: E/AndroidRuntime(534): at java.lang.reflect.Method.invoke(Method.java:511)
03-21 09:52:04.817: E/AndroidRuntime(534): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
03-21 09:52:04.817: E/AndroidRuntime(534): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
03-21 09:52:04.817: E/AndroidRuntime(534): at dalvik.system.NativeStart.main(Native Method)
03-21 09:52:04.817: E/AndroidRuntime(534): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0
03-21 09:52:04.817: E/AndroidRuntime(534): at android.content.res.Resources.getValue(Resources.java:1019)
03-21 09:52:04.817: E/AndroidRuntime(534): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2107)
03-21 09:52:04.817: E/AndroidRuntime(534): at android.content.res.Resources.getXml(Resources.java:907)
03-21 09:52:04.817: E/AndroidRuntime(534): at org.apache.cordova.api.PluginManager.loadPlugins(PluginManager.java:82)
03-21 09:52:04.817: E/AndroidRuntime(534): at org.apache.cordova.api.PluginManager.<init>(PluginManager.java:62)
03-21 09:52:04.817: E/AndroidRuntime(534): at org.apache.cordova.DroidGap$1.run(DroidGap.java:502)
03-21 09:52:04.817: E/AndroidRuntime(534): at android.app.Activity.runOnUiThread(Activity.java:4170)
03-21 09:52:04.817: E/AndroidRuntime(534): at org.apache.cordova.DroidGap.loadUrlIntoView(DroidGap.java:478)
03-21 09:52:04.817: E/AndroidRuntime(534): at org.apache.cordova.DroidGap.loadUrl(DroidGap.java:444)
03-21 09:52:04.817: E/AndroidRuntime(534): at com.phonegap.helloworld.app.onCreate(app.java:15)
03-21 09:52:04.817: E/AndroidRuntime(534): at android.app.Activity.performCreate(Activity.java:4465)
03-21 09:52:04.817: E/AndroidRuntime(534): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
03-21 09:52:04.817: E/AndroidRuntime(534): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
03-21 09:52:04.817: E/AndroidRuntime(534): ... 11 more
</init></init></init>

консоль:

[2012-03-21 09:49:28 - HelloPhoneGap] ------------------------------
[2012-03-21 09:49:28 - HelloPhoneGap] Android Launch!
[2012-03-21 09:49:28 - HelloPhoneGap] adb is running normally.
[2012-03-21 09:49:28 - HelloPhoneGap] Performing com.phonegap.helloworld.app activity launch
[2012-03-21 09:49:28 - HelloPhoneGap] Automatic Target Mode: launching new emulator with compatible AVD 'avd'
[2012-03-21 09:49:28 - HelloPhoneGap] Launching a new emulator with Virtual Device 'avd'
[2012-03-21 09:49:39 - Emulator] emulator: WARNING: Unable to create sensors port: Connection refused
[2012-03-21 09:49:39 - Emulator] emulator: emulator window was out of view and was recentered
[2012-03-21 09:49:39 - Emulator] 
[2012-03-21 09:49:41 - HelloPhoneGap] New emulator found: emulator-5554
[2012-03-21 09:49:41 - HelloPhoneGap] Waiting for HOME ('android.process.acore') to be launched...
[2012-03-21 09:51:23 - HelloPhoneGap] HOME is up on device 'emulator-5554'
[2012-03-21 09:51:23 - HelloPhoneGap] Uploading HelloPhoneGap.apk onto device 'emulator-5554'
[2012-03-21 09:51:24 - HelloPhoneGap] Installing HelloPhoneGap.apk...
[2012-03-21 09:52:02 - HelloPhoneGap] Success!
[2012-03-21 09:52:02 - HelloPhoneGap] Starting activity com.phonegap.helloworld.app on device emulator-5554
[2012-03-21 09:52:04 - HelloPhoneGap] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.phonegap.helloworld/.app }

может ли кто-нибудь помочь мне в моем случае?

2 ответа

1) В методе onCreate вы инициализировали как super.init(); если не делать 2) проверьте плагины, присутствующие в этом пути, " xml/res/plugins.xml ", если не найдете плагины здесь. Примечание: поставьте тег плагинов внутри кордоны как <cordova> <plugins> <plugin> </plugin> </plugins> </cordova>


Исправление, которое сработало для меня, заключалось в том, чтобы скопировать файл "config.xml" из корпорейской загрузки zip (lib/android/example/res/xml/config.xml) в папку проекта res/xml. Я столкнулся с этой же ошибкой, работая на странице Cordova 2.0.0 Getting Started with Android. Файл plugin.xml, похоже, не находится в Кордове 2.0.0 (по крайней мере, в ветке Android). Ошибка logcat все еще упоминает его.

licensed under cc by-sa 3.0 with attribution.