com.google.firebase.provider.FirebaseInitProvider: java.lang.ClassNotFoundException:com.google.firebase.provider.FirebaseInitProvider

前端 未结 2 1315
一生所求
一生所求 2021-01-27 23:18

Receving this error on KitKat and lower version running perfectly on Lollipop and above

I have included all the required jars in th gradle and Firebase

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-27 23:52

    This dependency includes the code for all of the Google Play Services APIs:

    compile 'com.google.android.gms:play-services:9.0.0'
    

    This is very likely causing your app to exceed the 65K method reference limit, requiring you to use Multidex to run on pre-Lollipop devices.

    You have two choices. You can include only the Play Services APIs you actually need. The list is here in the section titled Selectively compiling APIs into your executable. Or you can enable Multidex following the instructions here. Although you have multiDexEnabled true in your build.gradle file, that is only one of the three steps required to configure Multidex. You also need to include the library as a dependency and update your manifest.

    If you are using Android Studio 2.2.2, you can see how many method references are in your app using the APK Analyzer. From the menubar, select Build > Analyze APK. The APK is in folder .../app/build/outputs/apk. Select the APK file, and in the resulting window, click on classes.dex to see the number of methods and method references.

提交回复
热议问题