0
votes

I'm creating wallpaper app in the android studio with firebase. I got an error while compiling

Error:java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex Error:com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex Error:com.android.dex.DexException: Multiple dex files define Landroid/arch/lifecycle/LiveData$1;

i added "multiDexEnabled true" and "implementation 'com.android.support:multidex:1.0.3'"

and also i clean and rebuild my project

nothing happens

build.gradle

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
defaultConfig {
    applicationId "com.jimdo.saifstudios.wallpfeb"
    minSdkVersion 19
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner 
"android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation 'com.android.support:multidex:1.0.3'

    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.firebaseui:firebase-ui-database:3.1.2'
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.0'
    implementation 'com.android.support:recyclerview-v7:27.1.0'
    implementation 'com.android.support:cardview-v7:27.1.0'
    implementation 'com.android.support:design:27.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.google.firebase:firebase-database:11.8.0'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.1'
}

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

2 Answers

0
votes

Take a look at the docs of the firebase-ui.

https://github.com/firebase/FirebaseUI-Android

For the version you are using you have to use com.google.firebase:firebase-database:11.6.2

0
votes

If you are extending Application in your app. in my case i fixed it by adding MultiDex.install(this); to attachBaseContext(Context context) method.

you can take a look at: https://developer.android.com/studio/build/multidex.html