brijesh kumar
brijesh kumar

Reputation: 95

Unable to get FirebaseInitProvider exception

          apply plugin: 'com.android.application'

          android {
      compileSdkVersion 25
      buildToolsVersion "25.0.0"
      defaultConfig {
      applicationId "com.emperors.raaste"
      minSdkVersion 16
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled=true
}
buildTypes {
    release {
        multiDexEnabled=true
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    packagingOptions {
        exclude 'libs/jackson-core-asl-1.9.13.jar'
        exclude 'libs/jackson-mapper-asl-1.9.13.jar'
        exclude 'META-INF/ASL2.0'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'

    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7

}
}

  dependencies {
  compile fileTree(include: ['*.jar'], dir: 'libs')
  androidTestCompile('com.android.support.test.espresso:espresso-        core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile files('libs/map_sdk_2.0.jar')
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:support-v4:25.0.1'
compile 'com.android.support:design:25.0.1'
compile 'com.android.support:support-annotations:25.0.1'
compile 'com.google.android.gms:play-services-auth:10.0.1'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-storage:10.0.1'
compile 'com.theartofdev.edmodo:android-image-cropper:2.3.+'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.google.firebase:firebase-invites:10.0.1'
compile 'com.google.firebase:firebase-ads:10.0.1'
testCompile 'junit:junit:4.12'
compile 'com.google.code.gson:gson:2.4'
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.android.support:support-vector-drawable:25.0.1'
compile 'com.android.support:recyclerview-v7:25.0.1'
compile 'com.android.support:multidex:1.0.1'
}




apply plugin: 'com.google.gms.google-services'

This id my gradle file, I cannot resolve this issue I just updated Google services and repository and after that I am getting this error unable to get FirebaseInitProvider

I tried multidexenable=true and set MultiDexInstall(this); inside MultidexApplication still I am getting same exception is there anyone who can help me.

Upvotes: 1

Views: 180

Answers (2)

alcat
alcat

Reputation: 11

It seems to be the 'Multidex 64K Methods' - problem. The app works fine for Android API level >= 21, but if your minSdkVersion is < 21, you should follow these instructions:

  • add "multiDexEnabled true" in "android defaultConfig"
  • add "compile 'com.android.support:multidex:1.0.1'" in "dependencies"
  • add 'android:name="android.support.multidex.MultiDexApplication"' in application tag in manifest or change "extends Application" with "extends MultiDexApplication" if you override Application class.

Here's the link to the official page:

https://developer.android.com/studio/build/multidex.html

Upvotes: 1

Bob Snyder
Bob Snyder

Reputation: 38319

Although you have tried to enable Multidex, it does not appear to be correctly configured. Most likely there is something wrong with the way you have configured your Application class. If you do not need to subclass Application for reasons other than Multidex, just use the provided MultiDexApplication and modify the application element of your manifest with this line:

android:name="android.support.multidex.MultiDexApplication"

Otherwise extend your Application class from MultiDexApplication as described in the Multidex configuration instructions.

When Multidex is correctly configured and working, you will see messages in your logcat like these:

I/MultiDex: install
I/MultiDex: MultiDexExtractor.load(/data/app/com.qbix.multidextest-10.apk, false)
I/MultiDex: Detected that extraction must be performed.
I/MultiDex: install done

Although the current configuration of your app contains more than 65K method references and thus requires Multidex for pre-Lollipop devices, you might be able to eliminate that. Your dependency on com.google.android.gms:play-services:10.0.1 is pulling in ALL the Play Services APIs. They are listed here in the section titled Selectively compiling APIs into your executable. Remove com.google.android.gms:play-services:10.0.1 and replace it with the specific APIs you need. This will improve your build time, make your APK smaller, and may eliminate the need for Multidex.

Upvotes: 1

Related Questions