使用dex进行调试

时间:2017-09-12 12:32:59

标签: android gradle firebase-realtime-database android-gradle

我运行Firebase数据库,但我遇到了错误。我已经应用了插件:' com.google.gms.google-services',但是我收到了错误消息。我第一次运行程序时没有收到错误,但现在我收到错误

我的错误:

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'

您的建议对我很重要

非常感谢!

1 个答案:

答案 0 :(得分:1)

您正在使用相同库的不同版本:

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'

尽可能read here,firebaseui和firebase库之间存在依赖关系:

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

使用相同的版本来避免这些问题。