我无法在模拟器中运行我的简单应用,并且面对 Unfortunately myphonegap has stopped
我用这个班来打电话给我index.html
public class MainActivity extends DroidGap
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/index.html");
}
}
这是我的index.html
代码:
<!DOCTYPE HTML>
<html>
<head>
<title>Cordova</title>
<script type="text/javascript" charset="utf-8" src="cordova-1.9.0.js"></script>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
**One more point: i am using **Genymotion** emulator**
我已经添加了 phonegap1.2.0.jar 甚至 cordova.jar ,但是 当我运行我的应用程序时,logcat中存在这些错误。
01-15 16:51:42.206: E/SocketStream(112): readFully was waiting for 80688 bytes, got 32768
01-15 16:51:42.206: E/SocketStream(112): readFully was waiting for 47920 bytes, got 2272
01-15 16:51:42.206: E/SocketStream(112): readFully was waiting for 45648 bytes, got 32768
01-15 16:51:42.338: E/Trace(2776): error opening trace file: No such file or directory (2)
01-15 16:51:42.486: E/AndroidRuntime(2776): FATAL EXCEPTION: main
01-15 16:51:42.486: E/AndroidRuntime(2776): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myphonegap/com.example.myphonegap.MainActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x0
01-15 16:51:42.486: E/AndroidRuntime(2776): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
01-15 16:51:42.486: E/AndroidRuntime(2776): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
01-15 16:51:42.486: E/AndroidRuntime(2776): at android.app.ActivityThread.access$600(ActivityThread.java:130)
01-15 16:51:42.486: E/AndroidRuntime(2776): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
01-15 16:51:42.486: E/AndroidRuntime(2776): at android.os.Handler.dispatchMessage(Handler.java:99)
01-15 16:51:42.486: E/AndroidRuntime(2776): at android.os.Looper.loop(Looper.java:137)
01-15 16:51:42.486: E/AndroidRuntime(2776): at android.app.ActivityThread.main(ActivityThread.java:4745)
01-15 16:51:42.486: E/AndroidRuntime(2776): at java.lang.reflect.Method.invokeNative(Native Method)
01-15 16:51:42.486: E/AndroidRuntime(2776): at java.lang.reflect.Method.invoke(Method.java:511)
01-15 16:51:42.486: E/AndroidRuntime(2776): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
01-15 16:51:42.486: E/AndroidRuntime(2776): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
01-15 16:51:42.486: E/AndroidRuntime(2776): at dalvik.system.NativeStart.main(Native Method)
01-15 16:51:42.486: E/AndroidRuntime(2776): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0
01-15 16:51:42.486: E/AndroidRuntime(2776): at android.content.res.Resources.getValue(Resources.java:1013)
01-15 16:51:42.486: E/AndroidRuntime(2776): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2098)
01-15 16:51:42.486: E/AndroidRuntime(2776): at android.content.res.Resources.getXml(Resources.java:901)
01-15 16:51:42.486: E/AndroidRuntime(2776): at com.phonegap.api.PluginManager.loadPlugins(PluginManager.java:82)
01-15 16:51:42.486: E/AndroidRuntime(2776): at com.phonegap.api.PluginManager.<init>(PluginManager.java:62)
01-15 16:51:42.486: E/AndroidRuntime(2776): at com.phonegap.DroidGap$1.run(DroidGap.java:419)
01-15 16:51:42.486: E/AndroidRuntime(2776): at android.app.Activity.runOnUiThread(Activity.java:4591)
01-15 16:51:42.486: E/AndroidRuntime(2776): at com.phonegap.DroidGap.loadUrlIntoView(DroidGap.java:400)
01-15 16:51:42.486: E/AndroidRuntime(2776): at com.phonegap.DroidGap.loadUrl(DroidGap.java:361)
01-15 16:51:42.486: E/AndroidRuntime(2776): at com.example.myphonegap.MainActivity.onCreate(MainActivity.java:16)
01-15 16:51:42.486: E/AndroidRuntime(2776): at android.app.Activity.performCreate(Activity.java:5008)
01-15 16:51:42.486: E/AndroidRuntime(2776): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
01-15 16:51:42.486: E/AndroidRuntime(2776): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
01-15 16:51:42.486: E/AndroidRuntime(2776): ... 11 more
01-15 16:51:42.614: E/SocketStream(112): readFully was waiting for 80688 bytes, got 49152
01-15 16:51:42.614: E/SocketStream(112): readFully was waiting for 31536 bytes, got 16384
01-15 16:51:42.614: E/SocketStream(112): readFully was waiting for 15152 bytes, got 8924