无法实例化应用程序类

时间:2017-08-03 06:43:51

标签: android

  

8-03 11:35:19.736 5040-5043 /? E / ANDR-PERF-MPCTL:无效的配置文件号。 0,仅限总数0   08-03 11:35: 19.863 16408-16408 /? E / AndroidRuntime:致命异常:主要                                                      过程:com.app,PID:16408                                                      java.lang.RuntimeException:无法实例化应用程序com.app:java.lang.ClassNotFoundException:在路径上找不到类“com.app”:DexPathList [[zip file“/data/app/com.app-2/ base.apk“],nativeLibraryDirectories = [/ data / app / com.app-2 / lib / arm,/ data / app / com.app-2 / base.apk!/ lib / arababi-v7a,/ system / lib ,/ vendor / lib]]                                                          在android.app.LoadedApk.makeApplication(LoadedApk.java:802)                                                          在android.app.ActivityThread.handleBindApplication(ActivityThread.java:5376)                                                          在android.app.ActivityThread.-wrap2(ActivityThread.java)                                                          在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1541)                                                          在android.os.Handler.dispatchMessage(Handler.java:102)                                                          在android.os.Looper.loop(Looper.java:154)                                                          在android.app.ActivityThread.main(ActivityThread.java:6123)                                                          at java.lang.reflect.Method.invoke(Native Method)                                                          在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:867)                                                          在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)                                                       引起:java.lang.ClassNotFoundException:路径上没有找到类“com.app”:DexPathList [[zip                                                          在dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)                                                          at java.lang.ClassLoader.loadClass(ClassLoader.java:380)                                                          在java.lang.ClassLoader.loadClass(ClassLoader.java:312)                                                          在android.app.Instrumentation.newApplication(Instrumentation.java:1014)                                                          在android.app.LoadedApk.makeApplication(LoadedApk.java:796)                                                          在android.app.ActivityThread.handleBindApplication(ActivityThread.java:5376)                                                          在android.app.ActivityThread.-wrap2(ActivityThread.java)                                                          在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1541)                                                          在android.os.Handler.dispatchMessage(Handler.java:102)                                                          在android.os.Looper.loop(Looper.java:154)                                                          在android.app.ActivityThread.main(ActivityThread.java:6123)                                                          at java.lang.reflect.Method.invoke(Native Method)                                                          在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:867)                                                          在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)   08-03 11:35:19.983 1490-1523 /? E / BatteryStatsService:未提供控制器能源信息

2 个答案:

答案 0 :(得分:1)

通过禁用即时运行enter image description here

解决了上述问题

答案 1 :(得分:0)

我在多个线程上看到过这个问题,并且几乎总是Application类名不存在,拼写错误,名称错误或清单中包含错误的包。

仔细检查您的清单并注意是否设置了应用程序名称,是否为绿色或红色?您的应用即使是红色也会编译 - 或表示存在错误。

BTW发生在我身上,因为Instant Run已禁用。由于与名称相关的问题,即使类加载器无法找到Application类,Instant Run也经常被命名为罪魁祸首。