在某些设备上运行Android应用程序时出现Strange RuntimeException

时间:2016-05-25 12:21:51

标签: java android android-studio runtimeexception

我最近制作了一个Android应用程序,并将调试版本发布给某些人用于测试目的。一切似乎都很好,除了一些设备无法运行应用程序。调查后,打开应用程序时发生以下异常:

E/AndroidRuntime: FATAL EXCEPTION: main
Process: ir.irancell.neshan, PID: 23340
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/ir.irancell.neshan-1.apk"],nativeLibraryDirectories=[/data/app-lib/ir.irancell.neshan-1, /vendor/lib, /system/lib]]
    at android.app.LoadedApk.makeApplication(LoadedApk.java:516)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4722)
    at android.app.ActivityThread.access$1600(ActivityThread.java:172)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1368)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:146)
    at android.app.ActivityThread.main(ActivityThread.java:5653)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.android.tools.fd.runtime.BootstrapApplication" on path: DexPathList[[zip file "/data/app/ir.irancell.neshan-1.apk"],nativeLibraryDirectories=[/data/app-lib/ir.irancell.neshan-1, /vendor/lib, /system/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:67)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
    at android.app.Instrumentation.newApplication(Instrumentation.java:981)
    at android.app.LoadedApk.makeApplication(LoadedApk.java:511)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4722) 
    at android.app.ActivityThread.access$1600(ActivityThread.java:172) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1368) 
    at android.os.Handler.dispatchMessage(Handler.java:102) 
    at android.os.Looper.loop(Looper.java:146) 
    at android.app.ActivityThread.main(ActivityThread.java:5653) 
    at java.lang.reflect.Method.invokeNative(Native Method) 
    at java.lang.reflect.Method.invoke(Method.java:515) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107) 
    at dalvik.system.NativeStart.main(Native Method) 

奇怪的是,当我将这些有问题的设备连接到Android Studio并专门为他们编译应用程序时,应用运行得很好。但是,如果我生成一个APK文件并单独安装它们,一些设备仍然存在这个问题 谷歌搜索该问题,有人说(herehere)罪魁祸首是Instant Run功能,但我不认为Instant Run使用Generate signed APK时负责Get-Package 1}}。那可能是什么问题?

1 个答案:

答案 0 :(得分:0)

是的,似乎Instant Run是罪魁祸首。因此,禁用它可以解决问题。