构建失败,并显示“程序类型已存在:android.arch.core.util.Function”-Firebase依赖关系问题

时间:2018-11-14 02:43:37

标签: java android firebase gradle firebaseui

我的项目中有多个Firebase库,看来存在某种冲突,导致构建失败。以下是我的build.gradle:

  dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')

// Support library
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'

// Firebase
implementation 'com.google.firebase:firebase-storage:16.0.4'
implementation 'com.google.firebase:firebase-core:16.0.5'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.firebase:firebase-appindexing:16.0.2'
implementation 'com.google.firebase:firebase-firestore:17.1.3'
implementation 'com.firebaseui:firebase-ui-firestore:4.2.1'

// Third party
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.facebook.android:facebook-android-sdk:4.38.1'
implementation 'jp.wasabeef:recyclerview-animators:2.2.3'
implementation 'com.github.clans:fab:1.6.2'
implementation 'de.hdodenhof:circleimageview:2.0.0'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
implementation 'com.github.PhilJay:MPAndroidChart:v2.2.2'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
implementation 'com.android.support:multidex:1.0.3'
//
//    implementation "android.arch.core:runtime:1.1.1"
//    implementation "android.arch.core:common:1.1.1"


 }

添加以下内容后,便可以成功构建:

implementation "android.arch.core:runtime:1.1.1"
implementation "android.arch.core:common:1.1.1"

我张贴了一个类似的问题here,我也将日志记录也张贴在这里以供参考。我担心的是,上述2个依赖项的添加只是一个临时解决方案,因为我不想发布具有这些依赖项的应用程序。任何帮助表示赞赏!

2 个答案:

答案 0 :(得分:1)

要解决此问题,请更改以下代码行:

implementation 'com.google.firebase:firebase-database:16.0.4'
implementation 'com.firebaseui:firebase-ui-database:4.2.0'
implementation "com.google.firebase:firebase-firestore:17.1.2"
implementation 'com.firebaseui:firebase-ui-firestore:4.0.1'

implementation 'com.google.firebase:firebase-database:16.0.5'
implementation 'com.firebaseui:firebase-ui-database:4.2.1'
implementation 'com.google.firebase:firebase-firestore:17.1.3'
implementation 'com.firebaseui:firebase-ui-firestore:4.2.1'

还请确保使用'而不是"

答案 1 :(得分:0)

事实证明,问题与Firebase数据库依赖关系或Firebase UI依赖关系有关。我能够解决以下依赖性:

    // Firebase
implementation 'com.google.firebase:firebase-storage:16.0.4'
implementation 'com.google.firebase:firebase-core:16.0.5'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.firebase:firebase-appindexing:16.0.2'
implementation 'com.google.firebase:firebase-firestore:17.1.3'
implementation 'com.firebaseui:firebase-ui-firestore:4.2.1'