这个真的让我很紧张。在浏览了各种来源 2-3 天后,我找到了解决出现的常见问题的方法。
上下文基于使用 Android http://j.mp/MB1pTM 提供的 PhoneGap 演示。演示本身在使用 PhoneGap API 文档为 Android 4.0.3 进行精确设置时对我来说失败了。我收到以下错误消息:
07-16 23:01:58.485: E/AndroidRuntime(778): FATAL EXCEPTION: main
07-16 23:01:58.485: E/AndroidRuntime(778): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.test.shreyas.main/com.test.shreyas.main.HelloCordovaActivity}: java.lang.ClassNotFoundException: com.test.shreyas.main.HelloCordovaActivity
07-16 23:01:58.485: E/AndroidRuntime(778): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1880)
07-16 23:01:58.485: E/AndroidRuntime(778): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
07-16 23:01:58.485: E/AndroidRuntime(778): at android.app.ActivityThread.access$600(ActivityThread.java:123)
07-16 23:01:58.485: E/AndroidRuntime(778): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
07-16 23:01:58.485: E/AndroidRuntime(778): at android.os.Handler.dispatchMessage(Handler.java:99)
07-16 23:01:58.485: E/AndroidRuntime(778): at android.os.Looper.loop(Looper.java:137)
07-16 23:01:58.485: E/AndroidRuntime(778): at android.app.ActivityThread.main(ActivityThread.java:4424)
07-16 23:01:58.485: E/AndroidRuntime(778): at java.lang.reflect.Method.invokeNative(Native Method)
07-16 23:01:58.485: E/AndroidRuntime(778): at java.lang.reflect.Method.invoke(Method.java:511)
07-16 23:01:58.485: E/AndroidRuntime(778): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
07-16 23:01:58.485: E/AndroidRuntime(778): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
07-16 23:01:58.485: E/AndroidRuntime(778): at dalvik.system.NativeStart.main(Native Method)
07-16 23:01:58.485: E/AndroidRuntime(778): Caused by: java.lang.ClassNotFoundException: com.test.shreyas.main.HelloCordovaActivity
07-16 23:01:58.485: E/AndroidRuntime(778): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
07-16 23:01:58.485: E/AndroidRuntime(778): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
07-16 23:01:58.485: E/AndroidRuntime(778): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
07-16 23:01:58.485: E/AndroidRuntime(778): at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
07-16 23:01:58.485: E/AndroidRuntime(778): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871)
07-16 23:01:58.485: E/AndroidRuntime(778): ... 11 more