我在尝试加载程序时收到“无法实例化活动”错误。让我感到困惑的一件事是完全相同的代码在我的旧 PC 上运行。我刚刚用新的 eclipse / android SDK / 等构建了一个新的。我有两台机器运行相同的代码,一台工作正常,另一台给出这个错误。
有什么想法吗?
编辑:我在堆栈中注意到的一件事是
引起:java.lang.ClassNotFoundException: com.voldaran.puzzle.graBLOX.PopActivity in loader dalvik.system.PathClassLoader[/data/app/com.voldaran.puzzle.graBLOX-2.apk]
它列出了 graBLOX-2.apk 。为什么使用'-2.apk'?
当我在工作机器上手动重现此错误时,它不会显示最后一个 [] 部分。
安卓清单
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".PopActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:finishOnTaskLaunch="true"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="portrait"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
堆
04-21 17:33:42.284: E/AndroidRuntime(4045): FATAL EXCEPTION: main
04-21 17:33:42.284: E/AndroidRuntime(4045): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.voldaran.puzzle.graBLOX/com.voldaran.puzzle.graBLOX.PopActivity}: java.lang.ClassNotFoundException: com.voldaran.puzzle.graBLOX.PopActivity in loader dalvik.system.PathClassLoader[/data/app/com.voldaran.puzzle.graBLOX-2.apk]
04-21 17:33:42.284: E/AndroidRuntime(4045): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)
04-21 17:33:42.284: E/AndroidRuntime(4045): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
04-21 17:33:42.284: E/AndroidRuntime(4045): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
04-21 17:33:42.284: E/AndroidRuntime(4045): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
04-21 17:33:42.284: E/AndroidRuntime(4045): at android.os.Handler.dispatchMessage(Handler.java:99)
04-21 17:33:42.284: E/AndroidRuntime(4045): at android.os.Looper.loop(Looper.java:130)
04-21 17:33:42.284: E/AndroidRuntime(4045): at android.app.ActivityThread.main(ActivityThread.java:3683)
04-21 17:33:42.284: E/AndroidRuntime(4045): at java.lang.reflect.Method.invokeNative(Native Method)
04-21 17:33:42.284: E/AndroidRuntime(4045): at java.lang.reflect.Method.invoke(Method.java:507)
04-21 17:33:42.284: E/AndroidRuntime(4045): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-21 17:33:42.284: E/AndroidRuntime(4045): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-21 17:33:42.284: E/AndroidRuntime(4045): at dalvik.system.NativeStart.main(Native Method)
04-21 17:33:42.284: E/AndroidRuntime(4045): Caused by: java.lang.ClassNotFoundException: com.voldaran.puzzle.graBLOX.PopActivity in loader dalvik.system.PathClassLoader[/data/app/com.voldaran.puzzle.graBLOX-2.apk]
04-21 17:33:42.284: E/AndroidRuntime(4045): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
04-21 17:33:42.284: E/AndroidRuntime(4045): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
04-21 17:33:42.284: E/AndroidRuntime(4045): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
04-21 17:33:42.284: E/AndroidRuntime(4045): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
04-21 17:33:42.284: E/AndroidRuntime(4045): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)