java.lang.RuntimeException的:无法实例活动ComponentInfo /抛出java.lang.ClassNotFoundException [英] java.lang.RuntimeException: Unable to instantiate activity ComponentInfo / java.lang.ClassNotFoundException
问题描述
我在我的设备上运行,而有此错误。我一直在浏览的问题,我是pretty的确定提到我不是有同样的问题。我的两个活动的AndroidManifest声明和意图过滤器是存在的。我没有任何库(除了V4支持库,但在宣布它不会改变的问题)。我试图通过 .MainActivity
,但仍然没有运气取代我的清单 carpedujourproductions.quickpronote.MainActivity
。我运行的是Android 0.2.5工作室,所以我无法找到如何解决与Java构建潜在问题的路径/订单和出口
I'm having this error while running on my device. I've been browsing the issue and I'm pretty sure I'm not having the same issues as mentioned. Both of my activities are declared in the AndroidManifest and the intent filter is there. I have no libraries whatsoever (except v4 support library, but declaring it doesn't change the problem). I tried replacing in my Manifest carpedujourproductions.quickpronote.MainActivity
by .MainActivity
but still no luck. I'm running Android Studio 0.2.5 so I couldn't find how to resolve potential issues related to Java Build Path/Order and Export
我不禁注意到在树我MainActivity的图标有一个灰色的十字架上的左上角。
I couldn't help but noticing my MainActivity's icon in the tree had a grey cross on the upper-left corner.
logcat的:
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{carpedujourproductions.quickpronote/carpedujourproductions.quickpronote.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "carpedujourproductions.quickpronote.MainActivity" on path: DexPathList[[zip file "/data/app/carpedujourproductions.quickpronote-2.apk"],nativeLibraryDirectories=[/data/app-lib/carpedujourproductions.quickpronote-2, /vendor/lib, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2157)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2281)
at android.app.ActivityThread.access$600(ActivityThread.java:148)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1263)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5124)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:110)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "carpedujourproductions.quickpronote.MainActivity" on path: DexPathList[[zip file "/data/app/carpedujourproductions.quickpronote-2.apk"],nativeLibraryDirectories=[/data/app-lib/carpedujourproductions.quickpronote-2, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
... 12 more
随时通过code 浏览此处 AndroidManifest,MainActivity.java,FirstRun.java等
Feel free to browse through the code here for AndroidManifest, MainActivity.java, FirstRun.java, etc.
推荐答案
您 MainActivity.java
排除在编译,所以这个类是不包含在apk文件。删除行:
Your MainActivity.java
is excluded from compile, so this class isn't included in .apk. Remove line:
<file url="file://$PROJECT_DIR$/src/carpedujourproductions/quickpronote/MainActivity.java" />
从的的
文件(也可以从IDE做到这一点设置)。 excludeFromCompile
部分.idea / compiler.xml
from the excludeFromCompile
section of the .idea/compiler.xml
file (or you can do this from IDE settings).
这篇关于java.lang.RuntimeException的:无法实例活动ComponentInfo /抛出java.lang.ClassNotFoundException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!