Android Studio 2.3 does not work with instant start: debug apk crash with ClassNotFoundException

After updating Android Studio 2.3 (and gradle update), if I have instant launch activated and I install the application from Android Studio by launching or creating a signed apk, it works fine.

If I manually install debug apk, it immediately crashes when I open it, ClassNotFoundException .

Note: if I remove the link to the file provider, the class that is not found becomes the main one. This problem is related to apk debugging, which is created in the folder Assembly β†’ Output β†’ apk . If you run the application directly, it always works fine.

Without an instant start, there is no failure. There was no crash with previous versions of Android Studio.

 java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/com.vfirst.ifbagro-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.vfirst.ifbagro-1, /vendor/lib, /system/lib]] at android.app.ActivityThread.installProvider(ActivityThread.java:4993) at android.app.ActivityThread.installContentProviders(ActivityThread.java:4596) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4536) at android.app.ActivityThread.access$1300(ActivityThread.java:149) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1353) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5214) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/com.vfirst.ifbagro-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.vfirst.ifbagro-1, /vendor/lib, /system/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53) at java.lang.ClassLoader.loadClass(ClassLoader.java:501) at java.lang.ClassLoader.loadClass(ClassLoader.java:461) at android.app.ActivityThread.installProvider(ActivityThread.java:4978) at android.app.ActivityThread.installContentProviders(ActivityThread.java:4596) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4536) at android.app.ActivityThread.access$1300(ActivityThread.java:149) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1353) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5214) at java.lang.reflect.Method.invokeNative(Native Method) 
+5
source share
3 answers

I had the same error and solved it with MultiDex add build.gradle multiDexEnabled "true".

  android { defaultConfig { ... minSdkVersion 15 targetSdkVersion 25 multiDexEnabled true } ... } dependencies { compile 'com.android.support:multidex:1.0.1' 

described at this link: https://developer.android.com/studio/build/multidex.html

0
source

Try the following:

  android { defaultConfig { minSdkVersion 14 targetSdkVersion 25 multiDexEnabled true } } dependencies { compile 'com.android.support:multidex:1.0.1' 

this code in your manifest:

  <application ... android:name="android.support.multidex.MultiDexApplication"> ... </application> 

If you use your own application class, use this code:

 public class YouApplication extends Application { @Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); MultiDex.install(this); } } 

and then for the manifest:

  <application ... android:name="YOUR_PACKAGE.YouApplication"> ... </application> 

I hope to help you my friend

0
source

As for me, I tried the following: try to check whether the autorun of your phone automatically starts in your application. Allowing your application to start automatically, I think, will help in eliminating the problem of instant start. Hope this helps.

-2
source

Source: https://habr.com/ru/post/1265669/


All Articles