1

I run Firebase database and I have an error. I have apply plugin: 'com.google.gms.google-services', but I get an error. I did not get an error when I first ran the program but now I get an error

My error:

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 Lcom/google/android/gms/common/api/zza;

build.gradle

apply plugin: 'com.android.application'

 android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
    applicationId "com.yavuzoktay.foodapp"
    minSdkVersion 19
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
 }

 dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})

//Add Library


compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-core:9.0.0'
compile 'com.google.firebase:firebase-database:9.0.0'
compile 'info.hoang8f:fbutton:1.0.5'
compile 'com.rengwuxian.materialedittext:library:2.1.4'
compile 'com.android.support:cardview-v7:26.+'
compile 'com.android.support:recyclerview-v7:26.+'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.firebaseui:firebase-ui-database:1.2.0'
compile 'com.android.support:design:26.+'
testCompile 'junit:junit:4.12'



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

Your advice important for me

Thank you very much !

KENdi
  • 7,576
  • 2
  • 16
  • 31
Yavuz
  • 129
  • 1
  • 3
  • 17

1 Answers1

1

You are using different versions of the same libraries:

compile 'com.google.firebase:firebase-core:9.0.0'
compile 'com.google.firebase:firebase-database:9.0.0'
compile 'com.firebaseui:firebase-ui-database:1.2.0'

As you can read here there is a dependency between firebaseui and firebase libraries:

FirebaseUI Version  Firebase/Play Services Version
2.3.0               11.0.4
2.2.0               11.0.4
2.1.1               11.0.2
2.0.1               11.0.1
.....               .....
1.2.0               10.2.0

Use the same version to avoid these issue.

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841