安卓开发问题之 Unable to instantiate application com.android.tools.fd.runtime.BootstrapApplication

原创 2016年08月30日 17:04:21

API 21 之前的设备调试,开启Instant run,有可能报这个错,21之后的设备就不会有了,,我这边实践的,应该还是Instant Run 不稳定

所以把instant run 功能取消后在发布测试包就可以。

这个问题出现在程序 Launcher3 运行中,系统端需要我这里修改 Launcher3 的一些东西,修改了给他,出现如下错误:

--------- beginning of /dev/log/main
I/Process ( 1706): Sending signal. PID: 1706 SIG: 9
--------- beginning of /dev/log/system
I/ActivityManager(  731): Process com.inst.launcher3 (pid 1706) has died.
W/art     (  444): Could not get current activity
I/ActivityManager(  731): Start proc com.inst.launcher3 for activity com.inst.launcher3/.Launcher: pid=1729 uid=10034 gids={50034,}
I/art     ( 1729): Failed to open oat file from /system/priv-app/launcher3_INST.odex or /data/dalvik-cache/system@priv-app@launche.
E/art     ( 1729): Failed to open file: /data/dalvik-cache/system@priv-app@launcher3_INST.apk@classes.dex
E/art     ( 1729): Failed to open locked oat file: /data/dalvik-cache/system@priv-app@launcher3_INST.apk@classes.dex
W/art     ( 1729): Failed to open dex file: /system/priv-app/launcher3_INST.apk
D/AndroidRuntime( 1729): Shutting down VM
E/AndroidRuntime( 1729): FATAL EXCEPTION: main
E/AndroidRuntime( 1729): Process: com.inst.launcher3, PID: 1729
E/AndroidRuntime( 1729): java.lang.RuntimeException: Unable to instantiate application com.android.tools.fd.runtime.BootstrapApplication
E/AndroidRuntime( 1729):        at android.app.LoadedApk.makeApplication(LoadedApk.java:516)
E/AndroidRuntime( 1729):        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4317)
E/AndroidRuntime( 1729):        at android.app.ActivityThread.access$1500(ActivityThread.java:135)
E/AndroidRuntime( 1729):        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
E/AndroidRuntime( 1729):        at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 1729):        at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime( 1729):        at android.app.ActivityThread.main(ActivityThread.java:5017)
E/AndroidRuntime( 1729):        at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 1729):        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
E/AndroidRuntime( 1729):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
E/AndroidRuntime( 1729): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.android.tools.fd.runtime.BootstrapApp]
E/AndroidRuntime( 1729):        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
E/AndroidRuntime( 1729):        at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
E/AndroidRuntime( 1729):        at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
E/AndroidRuntime( 1729):        at android.app.Instrumentation.newApplication(Instrumentation.java:975)
E/AndroidRuntime( 1729):        at android.app.LoadedApk.makeApplication(LoadedApk.java:511)
E/AndroidRuntime( 1729):        ... 9 more
E/AndroidRuntime( 1729):        Suppressed: java.io.IOException: Unable to open dex file: /system/priv-app/launcher3_INST.apk
E/AndroidRuntime( 1729):                at dalvik.system.DexFile.openDexFileNative(Native Method)
E/AndroidRuntime( 1729):                at dalvik.system.DexFile.openDexFile(DexFile.java:296)
E/AndroidRuntime( 1729):                at dalvik.system.DexFile.<init>(DexFile.java:80)
E/AndroidRuntime( 1729):                at dalvik.system.DexFile.<init>(DexFile.java:59)
E/AndroidRuntime( 1729):                at dalvik.system.DexPathList.loadDexFile(DexPathList.java:263)
E/AndroidRuntime( 1729):                at dalvik.system.DexPathList.makeDexElements(DexPathList.java:230)
E/AndroidRuntime( 1729):                at dalvik.system.DexPathList.<init>(DexPathList.java:112)
E/AndroidRuntime( 1729):                at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:48)
E/AndroidRuntime( 1729):                at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:65)
E/AndroidRuntime( 1729):                at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:57)
E/AndroidRuntime( 1729):                at android.app.LoadedApk.getClassLoader(LoadedApk.java:326)
E/AndroidRuntime( 1729):                at android.app.LoadedApk.makeApplication(LoadedApk.java:508)
E/AndroidRuntime( 1729):                ... 9 more
E/AndroidRuntime( 1729):        Suppressed: java.lang.ClassNotFoundException: com.android.tools.fd.runtime.BootstrapApplication
E/AndroidRuntime( 1729):                at java.lang.Class.classForName(Native Method)
E/AndroidRuntime( 1729):                at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
E/AndroidRuntime( 1729):                at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
E/AndroidRuntime( 1729):                at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
E/AndroidRuntime( 1729):                ... 12 more
E/AndroidRuntime( 1729):        Caused by: java.lang.NoClassDefFoundError: Class "Lcom/android/tools/fd/runtime/BootstrapApplicatid
E/AndroidRuntime( 1729):                ... 16 more
W/ActivityManager(  731):   Force finishing activity com.inst.launcher3/.Launcher
W/ActivityManager(  731): Activity pause timeout for ActivityRecord{64d7f5f8 u0 com.inst.launcher3/.Launcher t16 f}

从错误日志里可以看出是:运行时错误,应用不能实例化, google 了下,原来遇到此问题的还不少呢,

Unable to instantiate application com.android.tools.fd.runtime.BootstrapApplication ?Android

解决


stackflow上给出的三种解决方法:

1/3:

Changing:

classpath 'com.android.tools.build:gradle:2.0.0-alpha1'
By:

classpath 'com.android.tools.build:gradle:1.2.3'
2/3:

Changing:

buildToolsVersion '23.0.2'
By:

buildToolsVersion "21.1.2"
3/3: (in <project folder>/.idea/gradle.xml)

And:

<option name="gradleHome" value="$APPLICATION_HOME_DIR$/gradle/gradle-2.8" />
By:

<option name="gradleHome" value="$APPLICATION_HOME_DIR$/gradle/gradle-2.4" />

我只用了第一个方法就搞定了:
Changing:

classpath 'com.android.tools.build:gradle:2.0.0-beta5'
By:

classpath 'com.android.tools.build:gradle:1.5.0'

分享是一种美德,更是一种生活方式!!

也许你会说我是一个梦想者,但我不是唯一的一个。

悦分享,越快乐^_^

欢迎交流,转载请注明出处,谢谢!



文/追风917(简书作者)
原文链接:http://www.jianshu.com/p/833c97eb8ba7
著作权归作者所有,转载请联系作者获得授权,并标注“简书作者”。

相关文章推荐

java.lang.RuntimeException: Unable to instantiate application com.android.tools.fd.runtime.Bootstrap

问题: java.lang.RuntimeException: Unable to instantiate application com.android.tools.fd.runtime.Boot...

Didn't find class "com.android.tools.fd.runtime.BootstrapApplication"

解决Didn’t find class “com.android.tools.fd.runtime.BootstrapApplication”

android 构建项目bug之 Didn't find class "com.android.tools.fd.runtime.BootstrapApplication"

Didn't find class "com.android.tools.fd.runtime.BootstrapApplication" 如果你出现这个问题,这是gradle构建不成熟的bug ...
  • axuanqq
  • axuanqq
  • 2016年02月15日 10:23
  • 3858

Unable to instantiate application com.android.tools.fd.runtime.BootstrapApplication 解决办法

相信很多人都遇到过这个问题,用Android Studio正在运行程序的时候,突然不知道什么原因,报一个找不到application或者找不到activity的错误(java.lang.ClassNo...

ClassNotFoundException:"com.android.tools.fd.runtime.BootstrapApplication"

com.android.tools.fd.runtime.BootstrapApplication.AndroidRuntime: ClassNotFoundException InstantRun

Didn't find class "com.android.tools.fd.runtime.BootstrapApplication"

在部分机器上开启开启Instantrun,出现“ClassNotFoundException: Didn't find class"com.android.tools.fd.runtime.Boots...

安卓开发问题之 Unable to instantiate application com.android.tools.fd.runtime.BootstrapApplication

安卓开发问题之 Unable to instantiate application com.android.tools.fd.runtime.BootstrapApplication...

安卓- apk安装出现闪退java.lang.RuntimeException: Unable to instantiate application

Android Apk安装出现java.lang.RuntimeException: Unable to instantiate application

Unable to instantiate application com.honjane.app.MyApplication

坑了一个晚上的crash ,立个flag纪念下 Process: com.honjane.app, PID: 19363 ...

运行Android项目 Unable to instantiate application, IllegalAccessException

运行Android项目报如下错误 06-08 14:08:52.370 12415-12415/com.dobest E/AndroidRuntime: FATAL EXCEPTION: main ...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:安卓开发问题之 Unable to instantiate application com.android.tools.fd.runtime.BootstrapApplication
举报原因:
原因补充:

(最多只允许输入30个字)