当我运行我的Android应用程序时,它指示错误但代码中没有错误。错误如下

时间:2016-10-20 15:04:54

标签: android

10-20 20:18:53.146 19159-19159/? I/art: Late-enabling -Xcheck:jni
10-20 20:18:53.221 19159-19159/com.example.deeps.myapplication D/AndroidRuntime: Shutting down VM
10-20 20:18:53.222 19159-19159/com.example.deeps.myapplication E/AndroidRuntime: FATAL EXCEPTION: main
     Process: com.example.deeps.myapplication, PID: 19159
     java.lang.RuntimeException: Unable to instantiate application com.android.tools.fd.runtime.BootstrapApplication: java.lang.ClassNotFoundException: Didn't find class "com.android.tools.fd.runtime.BootstrapApplication" on path: DexPathList[[zip file "/data/app/com.example.deeps.myapplication-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
         at android.app.LoadedApk.makeApplication(LoadedApk.java:563)
         at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4504)
         at android.app.ActivityThread.access$1500(ActivityThread.java:144)
         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1346)
         at android.os.Handler.dispatchMessage(Handler.java:102)
         at android.os.Looper.loop(Looper.java:135)
         at android.app.ActivityThread.main(ActivityThread.java:5235)
         at java.lang.reflect.Method.invoke(Native Method)
         at java.lang.reflect.Method.invoke(Method.java:372)
         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898)
         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)

Caused by: java.lang.ClassNotFoundException: Didn't find class "com.android.tools.fd.runtime.BootstrapApplication" on path: DexPathList[[zip file "/data/app/com.example.deeps.myapplication-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
         at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
         at android.app.Instrumentation.newApplication(Instrumentation.java:979)
         at android.app.LoadedApk.makeApplication(LoadedApk.java:558)
         at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4504) 
         at android.app.ActivityThread.access$1500(ActivityThread.java:144) 
         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1346) 
         at android.os.Handler.dispatchMessage(Handler.java:102) 
         at android.os.Looper.loop(Looper.java:135) 
         at android.app.ActivityThread.main(ActivityThread.java:5235) 
         at java.lang.reflect.Method.invoke(Native Method) 
         at java.lang.reflect.Method.invoke(Method.java:372) 
         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898) 
         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693) 
        Suppressed: java.lang.ClassNotFoundException: com.android.tools.fd.runtime.BootstrapApplication
         at java.lang.Class.classForName(Native Method)
         at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
         at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
                ... 13 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
10-20 20:18:53.253 19159-19159/? I/Process: Sending signal. PID: 19159 SIG: 9

1 个答案:

答案 0 :(得分:0)

请尝试所有这些选项,我知道结果。我认为禁用即时运行可以解决这个问题,但也请一次清理/重建项目。

  1. 在Android Studio中停用“即时运行”选项。要禁用即时运行转到文件 - >设置 - >构建,执行,部署 - >即时运行--->取消选中“启用即时运行”
  2. Android Studio菜单 - 构建 - >重建项目。
  3. 如果这不起作用,那么也试试。

    • 将gradle构建版本更改为 classpath'com.android.tools.build:grad:1.2.3'