Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple Dex files error. Landroid/arch/lifecycle/LiveData$1

Please help me out. I have been stuck on this problem for so long. I am getting this error when I build my app

Error:Execution failed for task ':app:transformClassesWithDexForDebug'. com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Landroid/arch/lifecycle/LiveData$1;

Here is my app level build.gradle file

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
    applicationId "com.exploro.socialmediaapp"
    minSdkVersion 15
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    externalNativeBuild {
        cmake {
            cppFlags "-std=c++11"
        }
    }
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
externalNativeBuild {
    cmake {
        path "CMakeLists.txt"
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.0',          {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:27.+'
compile 'com.android.support:recyclerview-v7:27.+'
compile 'com.android.support:design:27.+'
compile 'com.google.firebase:firebase-auth:11.0.4'
compile 'com.android.support:support-v4:27.+'
compile 'com.google.firebase:firebase-database:11.0.4'
compile 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
compile 'com.google.firebase:firebase-storage:11.0.4'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.firebaseui:firebase-ui-database:2.2.0'
compile 'id.zelory:compressor:2.0.0'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.google.firebase:firebase-messaging:11.0.4'
compile 'com.github.chrisbanes:PhotoView:2.0.0'
testCompile 'junit:junit:4.12'
}

apply plugin: 'com.google.gms.google-services'
like image 609
Ishan Gupta Avatar asked Oct 28 '22 17:10

Ishan Gupta


1 Answers

Just fix firebase ui version to 3.2.2. Change

compile 'com.firebaseui:firebase-ui-database:2.2.0'

to

compile 'com.firebaseui:firebase-ui-database:3.2.2'
like image 117
brucemax Avatar answered Nov 15 '22 07:11

brucemax