我最近将 Eclipse 升级到 Juno 版本,一切似乎都在工作。几周后(现在)我需要在 Android 应用上工作,所以我重新安装了 ADT 插件。它需要更新外部 Android SDK 目录中的一些相关内容。在那之后,一切似乎都很好。
但是,一旦我在模拟器和测试设备上启动应用程序,应用程序就会崩溃。
09-10 14:55:14.879: I/ActivityManager(1571): Start proc nl.reinders.android.inventoryapp for activity nl.reinders.android.inventoryapp/.MainMenu: pid=5890 uid=10027 gids={3001, 3002, 3003}
09-10 14:55:14.999: W/dalvikvm(5890): Unable to resolve superclass of Lnl/reinders/android/inventoryapp/MyApplication; (239)
09-10 14:55:14.999: W/dalvikvm(5890): Link of class 'Lnl/reinders/android/inventoryapp/MyApplication;' failed
09-10 14:55:15.009: W/dalvikvm(5890): threadid=1: thread exiting with uncaught exception (group=0x40018560)
09-10 14:55:15.009: E/AndroidRuntime(5890): FATAL EXCEPTION: main
09-10 14:55:15.009: E/AndroidRuntime(5890): java.lang.RuntimeException: Unable to instantiate application nl.reinders.android.inventoryapp.MyApplication: java.lang.ClassNotFoundException: nl.reinders.android.inventoryapp.MyApplication in loader dalvik.system.PathClassLoader[/data/app/nl.reinders.android.inventoryapp-2.apk]
09-10 14:55:15.009: E/AndroidRuntime(5890): at android.app.LoadedApk.makeApplication(LoadedApk.java:466)
09-10 14:55:15.009: E/AndroidRuntime(5890): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3264)
09-10 14:55:15.009: E/AndroidRuntime(5890): at android.app.ActivityThread.access$2200(ActivityThread.java:117)
09-10 14:55:15.009: E/AndroidRuntime(5890): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:969)
09-10 14:55:15.009: E/AndroidRuntime(5890): at android.os.Handler.dispatchMessage(Handler.java:99)
09-10 14:55:15.009: E/AndroidRuntime(5890): at android.os.Looper.loop(Looper.java:123)
09-10 14:55:15.009: E/AndroidRuntime(5890): at android.app.ActivityThread.main(ActivityThread.java:3729)
09-10 14:55:15.009: E/AndroidRuntime(5890): at java.lang.reflect.Method.invokeNative(Native Method)
09-10 14:55:15.009: E/AndroidRuntime(5890): at java.lang.reflect.Method.invoke(Method.java:507)
09-10 14:55:15.009: E/AndroidRuntime(5890): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:874)
09-10 14:55:15.009: E/AndroidRuntime(5890): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:632)
09-10 14:55:15.009: E/AndroidRuntime(5890): at dalvik.system.NativeStart.main(Native Method)
09-10 14:55:15.009: E/AndroidRuntime(5890): Caused by: java.lang.ClassNotFoundException: nl.reinders.android.inventoryapp.MyApplication in loader dalvik.system.PathClassLoader[/data/app/nl.reinders.android.inventoryapp-2.apk]
09-10 14:55:15.009: E/AndroidRuntime(5890): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
09-10 14:55:15.009: E/AndroidRuntime(5890): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
09-10 14:55:15.009: E/AndroidRuntime(5890): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
09-10 14:55:15.009: E/AndroidRuntime(5890): at android.app.Instrumentation.newApplication(Instrumentation.java:942)
09-10 14:55:15.009: E/AndroidRuntime(5890): at android.app.LoadedApk.makeApplication(LoadedApk.java:461)
09-10 14:55:15.009: E/AndroidRuntime(5890): ... 11 more
09-10 14:55:15.019: W/ActivityManager(1571): Force finishing activity nl.reinders.android.inventoryapp/.MainMenu
09-10 14:55:15.529: W/ActivityManager(1571): Activity pause timeout for HistoryRecord{408f7cb0 nl.reinders.android.inventoryapp/.MainMenu}
09-10 14:55:25.649: W/ActivityManager(1571): Activity destroy timeout for HistoryRecord{408f7cb0 nl.reinders.android.inventoryapp/.MainMenu}
至关重要的恕我直言,警告“无法解析超类”,然后导致类本身没有被加载。奇怪的是该类存在于 Eclipse 中,它是 RoboGuice 的应用程序类 (http://code.google.com/p/roboguice/) 并且它的 jar 存在。我可以点击它,打开类文件(当然不可读,但是)......
巧合的是我仍然有旧环境(Eclipse Indigo),但由于升级了Android SDK,它需要更新ADT插件,并且有同样的问题。
为什么 RoboGuice 罐子似乎不包括在内有什么建议吗?