我试图哄骗许多android库一起很好地玩,但是我对版本控制系统感到沮丧。
我设法使firebase版本的crashlytics正常工作,但是我目前无法使其与admob一起正常工作:
在我的应用程序“ build.gradle”中,我具有以下依赖项部分:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
implementation 'com.crashlytics.sdk.android:crashlytics-ndk:2.0.5'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.6'
implementation 'com.google.android.gms:play-services-ads:16.0.1'
}
哪个会产生此错误:
Failed to resolve: com.google.android.gms:play-services-ads:16.0.1
“ 16.0.4”也失败,而“ 17.1.1”产生此错误:
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.firebase:firebase-core@16.0.1
-- Project 'app' depends onto com.google.android.gms:play-services-ads@17.1.1
认为可能所有依赖项都必须为“ 17.1.1”,导致gradle找不到“ com.google.firebase:firebase-core:17.1.1”
我怀疑我是否一个人发现这种汤有些不透明。有没有更简单的方法来确保一组库可以很好地协同工作?
答案 0 :(得分:2)
添加:
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.android.gms:play-services-ads:17.1.1'
在顶级gradle文件中使用最新版本的Google Play服务:
classpath 'com.google.gms:google-services:4.0.2'
注意:
您需要按照firebase文档中的指定,在顶级gradle文件中添加google()存储库,并且该文件也应位于jcenter()之前:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.0.2'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
答案 1 :(得分:1)
请使用以下版本:
implementation 'com.google.android.gms:play-services-ads:17.1.1'
还将firebase-core库更新为版本16.0.4
:
implementation 'com.google.firebase:firebase-core:16.0.4'