Skip to content Skip to sidebar Skip to footer

Firebase Android SDK Causing Gradle Error (With No Error Cause)

I am trying to use Firebase in my Android Studio project and it is giving me an empty Gradle error. I have tried using the Firebase SDK with Gradle, as well as putting the jar in m

Solution 1:

Have this content in your build.gradle (Module:app)

    android {

    //so default auto generated blocks will be here ...

        packagingOptions {
            exclude 'META-INF/LICENSE'
            exclude 'META-INF/LICENSE-FIREBASE.txt'
            exclude 'META-INF/NOTICE'
        }

    } // end of android node 

     dependencies {
            compile fileTree(dir: 'libs', include: ['*.jar'])
            compile 'com.android.support:appcompat-v7:22.0.0'
            compile 'com.android.support:support-v4:22.0.0'
            compile 'com.firebase:firebase-client-android:2.3.1'
        }

Solution 2:

Thanks for your help guys, it looks like it was a dex limit error. Adding the Firebase SDK must have put me over the limit, to fix this i had to add multiDexEnabled true in the defaultConfig section of my app:build.gradle file as well as compile 'com.android.support:multidex:1.0.0' in the dependencies


Solution 3:

you might need to enable multidex.

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.0"

    defaultConfig {
        ...
        minSdkVersion 14
        targetSdkVersion 21
        ...

        // Enabling multidex support.
        multiDexEnabled true
    }
    ...
}

dependencies {
  compile 'com.android.support:multidex:1.0.0'
}

Solution 4:

The complete app/build.gradle from one of my projects:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.firebaseuser.nanochat"
        minSdkVersion 21
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE-FIREBASE.txt'
        exclude 'META-INF/NOTICE'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.1.1'
    compile 'com.firebase:firebase-client-android:2.3.1+'
}

Post a Comment for "Firebase Android SDK Causing Gradle Error (With No Error Cause)"