簡體   English   中英

Gradle 錯誤為動態鏈接添加 firebase 依賴項

[英]Gradle Error adding firebase dependencies for dynamic link

在我的build.gradle ,我嘗試添加implementation 'com.google.firebase:firebase-dynamic-links:16.0.0' ,但后來我收到了這個錯誤:

ERROR: In project 'app' a resolved Google Play services library dependency depends on 
another at an exact version (e.g. "[15.0.4]", but isn't being resolved to that version.
Behavior exhibited by the library will be unknown.

Dependency failing: com.google.firebase:firebase-analytics-impl:16.0.0 -> 
com.google.android.gms:play-services-measurement-base@[15.0.4],
but play-services-measurement-base version was 16.5.0.

The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
ifact with the issue.
-- Project 'app' depends onto com.google.android.gms:play-services-measurement@{strictly 16.5.0}
-- Project 'app' depends onto com.google.firebase:firebase-analytics@{strictly 16.5.0}
-- Project 'app' depends onto com.google.android.gms:play-services-measurement-base@{strictly 16.5.0}
-- Project 'app' depends onto com.google.firebase:firebase-dynamic-links@16.0.0
-- Project 'app' depends onto com.google.firebase:firebase-analytics-impl@{strictly 16.0.0}
-- Project 'app' depends onto com.google.android.gms:play-services-measurement-sdk-api@{strictly 16.5.0}
-- Project 'app' depends onto com.google.android.gms:play-services-measurement-api@{strictly 16.5.0}
-- Project 'app' depends onto com.google.android.gms:play-services-measurement-sdk@{strictly 16.5.0}
-- Project 'app' depends onto com.google.firebase:firebase-core@16.0.9
-- Project 'app' depends onto com.google.android.gms:play-services-measurement-impl@{strictly 16.5.0}
-- Project 'app' depends onto com.google.firebase:firebase-core@{strictly 16.0.9}
-- Project 'app' depends onto com.google.firebase:firebase-dynamic-links@{strictly 16.0.0}

For extended debugging info execute Gradle from the command line with ./gradlew --info :app:assembleDebug to see the dep
endency paths to the artifact. This error message came from the google-services Gradle plugin, report issues at https://
github.com/google/play-services-plugins and disable by adding "googleServices { disableVersionCheck = false }" to your b
uild.gradle file.

這是在添加動態鏈接之前build.gradle外觀

dependencies {

    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'

    implementation 'com.google.firebase:firebase-core:16.0.9'
    implementation 'com.google.firebase:firebase-messaging:18.0.0'
    implementation 'com.google.firebase:firebase-auth:17.0.0'
    implementation 'com.google.firebase:firebase-storage:17.0.0'
    implementation 'com.google.firebase:firebase-firestore:19.0.1'
    implementation 'com.firebaseui:firebase-ui-firestore:4.2.1'

    implementation 'com.google.android.gms:play-services-base:16.1.0'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    implementation 'com.google.android.gms:play-services-gcm:16.1.0'
    implementation 'com.google.android.gms:play-services-identity:16.0.0'
    implementation 'com.google.android.gms:play-services-auth-api-phone:16.0.0'

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

我也嘗試更新我的 Firebase 依賴項,但是每當我這樣做時,我都會遇到此錯誤-

ERROR: Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
    is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
    Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:16:5-188:19 to override.

因此,我將它們保留在舊版本中以避免上述情況。

不能同時依賴com.android.supportandroidx - Google Play Services 和 Firebase 的更高版本都androidx依賴項。 這些選項可供選擇:

  • 要么將依賴項降級到仍然使用com.android.support版本。
  • 遷移到 androidx

dependencies {

    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.google.android.material:material:1.0.0'

    implementation 'com.google.firebase:firebase-core:17.0.1'
    implementation 'com.google.firebase:firebase-messaging:19.0.1'
    implementation 'com.google.firebase:firebase-auth:18.1.0'
    implementation 'com.google.firebase:firebase-storage:18.1.1'
    implementation 'com.google.firebase:firebase-firestore:20.2.0'
    implementation 'com.firebaseui:firebase-ui-firestore:4.2.1'

    implementation 'com.google.android.gms:play-services-base:17.1.0'
    implementation 'com.google.android.gms:play-services-location:17.0.0'
    implementation 'com.google.android.gms:play-services-auth:17.0.0'
    implementation 'com.google.android.gms:play-services-gcm:17.0.0'
    implementation 'com.google.android.gms:play-services-identity:17.0.0'
    implementation 'com.google.android.gms:play-services-auth-api-phone:17.1.0'
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM