2

Help! I have an application on the Android store and one of my users recently reported a bug, but I am unable to find where the source of the error is. Here is the ANR report:

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 "/mnt/asec/com.applicationcomp.myapplication-1/pkg.apk"],nativeLibraryDirectories=[/mnt/asec/com.applicationcomp.myapplication-1/lib, /system/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:516)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4580)
at android.app.ActivityThread.access$1500(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1290)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5299)
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:932)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:748)
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 "/mnt/asec/com.applicationcomp.myapplication-1/pkg.apk"],nativeLibraryDirectories=[/mnt/asec/com.applicationcomp.myapplication-1/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.app.Instrumentation.newApplication(Instrumentation.java:987)
at android.app.LoadedApk.makeApplication(LoadedApk.java:511)
... 11 more

Does anyone know that causes of these errors? This apparently is occurring as soon as the app is started up on an Android 4.4 device (I've also got another report of this happening on 4.2 as well).

*****IMPORTANT NOTE****** For some reason, this seems to only be occurring on some 4.4 devices, and unfortunately I am unable to replicate it in the Android Studio Emulator

Rick B
  • 25
  • 4
  • There is a similar question answered [here](http://stackoverflow.com/questions/33967703/unable-to-instantiate-application-com-android-tools-fd-runtime-bootstrapapplicat). – eXirrah Sep 23 '16 at 19:44
  • @eXirrah - that's about `java.lang.IllegalStateException`, while the current one is `CNFE` one. @Rick B - CNFE, not ANR )) – Mixaz Sep 23 '16 at 19:49

3 Answers3

0

check if the class that you're trying to start is register in your manifest. maybe it isn't and because of that you get this error. hope it will work.

0

Look at https://code.google.com/p/android/issues/detail?id=199327 - seems that you enabled Instant Run feature and it causes that problem on Android 4 as it is not supported there (though it should not crash the app that rude of course, but it's probably a bug).

Try to build the app with Instant Run disabled.

According to https://medium.com/google-developers/instant-run-how-does-it-work-294a1633367f#.bo88mglpe Instant Run injects some code (App Server) into the app, who knows what may happen on Android 4 then ))

Mixaz
  • 4,068
  • 1
  • 29
  • 55
  • Ok, I unchecked it. Any idea why this is only occurring on some 4.4 devices but not others? – Rick B Sep 23 '16 at 19:57
  • It's hard to know for sure, probably Instant Run authors could give some light for it. As you can see from the bug the feature even causes problems on Android 6 devices where it should work. Just a guess - the feature has a run-time check and it tells it to enable Instant Run on devices where it doesn't actually work. Then the feature can't get proper support from native OS layer and crashes. – Mixaz Sep 23 '16 at 20:04
  • another example of a problem causing by Instant Run: http://stackoverflow.duapp.com/questions/36491692/android-studio-2-0-instant-run-causes-dexfile-to-not-load-all-classes – Mixaz Sep 23 '16 at 20:13
0

Android ClassNotFoundException: Didn't find class on path

It seems that it might be a conflict between android support library version and the library project

Community
  • 1
  • 1
Gustavo Conde
  • 927
  • 12
  • 20
  • Doesn't the name of the class com.android.tools.fd.runtime.BootstrapApplication say something for you? It doesn't look like a user class you're trying to locale on ClassPath – Mixaz Sep 23 '16 at 19:52
  • If you follow the link I put you'll find some solutions. – Gustavo Conde Sep 23 '16 at 19:54