0

刚刚购买了 PhoneGap 2.x Mobile Application Development Hotshot 这本书,以提高我使用 PhoneGap 的知识并尝试运行书中的一些应用程序。我从他们的 github 存储库 ( https://github.com/photokandyStudios/PhoneGap-HotShot-Book-Code-Bundle ) 下载了谁的应用程序,例如,尝试从 Chapter1 (QuizApp) 运行第一个应用程序。使用 Eclipse(导入 > 现有 Android 代码到工作区)导入整个文件夹,当我尝试在我的模拟器或真正的 Android 设备上运行它时,它只是停止工作并关闭。看起来一切都在正确的位置,但什么都没有。

在这里,我将提供我的 LogCat 信息:

07-26 15:24:51.418: E/Trace(853): error opening trace file: No such file or directory (2)
07-26 15:24:51.688: W/dalvikvm(853): Unable to resolve superclass of Lcom/phonegaphotshot/QuizTime/QuizTime; (15)
07-26 15:24:51.688: W/dalvikvm(853): Link of class 'Lcom/phonegaphotshot/QuizTime/QuizTime;' failed
07-26 15:24:51.718: D/AndroidRuntime(853): Shutting down VM
07-26 15:24:51.718: W/dalvikvm(853): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
07-26 15:24:51.798: E/AndroidRuntime(853): FATAL EXCEPTION: main
07-26 15:24:51.798: E/AndroidRuntime(853): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.phonegaphotshot.QuizTime/com.phonegaphotshot.QuizTime.QuizTime}: java.lang.ClassNotFoundException: com.phonegaphotshot.QuizTime.QuizTime
07-26 15:24:51.798: E/AndroidRuntime(853):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983)
07-26 15:24:51.798: E/AndroidRuntime(853):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
07-26 15:24:51.798: E/AndroidRuntime(853):  at android.app.ActivityThread.access$600(ActivityThread.java:130)
07-26 15:24:51.798: E/AndroidRuntime(853):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
07-26 15:24:51.798: E/AndroidRuntime(853):  at android.os.Handler.dispatchMessage(Handler.java:99)
07-26 15:24:51.798: E/AndroidRuntime(853):  at android.os.Looper.loop(Looper.java:137)
07-26 15:24:51.798: E/AndroidRuntime(853):  at android.app.ActivityThread.main(ActivityThread.java:4745)
07-26 15:24:51.798: E/AndroidRuntime(853):  at java.lang.reflect.Method.invokeNative(Native Method)
07-26 15:24:51.798: E/AndroidRuntime(853):  at java.lang.reflect.Method.invoke(Method.java:511)
07-26 15:24:51.798: E/AndroidRuntime(853):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
07-26 15:24:51.798: E/AndroidRuntime(853):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
07-26 15:24:51.798: E/AndroidRuntime(853):  at dalvik.system.NativeStart.main(Native Method)
07-26 15:24:51.798: E/AndroidRuntime(853): Caused by: java.lang.ClassNotFoundException: com.phonegaphotshot.QuizTime.QuizTime
07-26 15:24:51.798: E/AndroidRuntime(853):  at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
07-26 15:24:51.798: E/AndroidRuntime(853):  at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
07-26 15:24:51.798: E/AndroidRuntime(853):  at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
07-26 15:24:51.798: E/AndroidRuntime(853):  at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
07-26 15:24:51.798: E/AndroidRuntime(853):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
07-26 15:24:51.798: E/AndroidRuntime(853):  ... 11 more

谢谢你的帮助

4

1 回答 1

0

解决了!如果有人遇到类似问题,请逐步执行此操作:

右键单击 Cordovaxxx.jar -> Configure Build Path in Tab Order and Export 并确保选中这些:

1. Android (in my case was Adnroid 4.1.2)
2. Android Dependencies
3. Cordova....
4. ..../src
5. ..../gen
于 2013-07-26T15:48:04.610 回答