[英]Android gradle libraries 'failure to resolve'
I'm trying to coax a number of android libraries to play nicely together but I'm becoming frustrated with the versioning system. 我试图哄骗许多android库一起很好地玩,但是我对版本控制系统感到沮丧。
I've managed to get the firebase version of crashlytics working but I cannot currently get this to work well with admob: 我已经设法使rashbases的firebase版本能够正常工作,但是目前无法使其与admob一起正常工作:
in my app 'build.gradle' I have the following dependency section: 在我的应用程序“ 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'
}
Which produces this error: 产生此错误:
Failed to resolve: com.google.android.gms:play-services-ads:16.0.1
'16.0.4' also fails whereas '17.1.1' produces this error: '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
thinking that maybe all of the dependencies need to be '17.1.1' results in gradle not finding 'com.google.firebase:firebase-core:17.1.1' 认为可能所有依赖项都必须为'17 .1.1'导致gradle无法找到'com.google.firebase:firebase-core:17.1.1'
I doubt I'm alone in finding this version soup somewhat opaque. 我怀疑我是否一个人发现这种汤有点不透明。 Is there an easier way to ensure a set of libraries that work well together? 有没有更简单的方法来确保一组库可以很好地协同工作?
Add: 加:
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.android.gms:play-services-ads:17.1.1'
and in top level gradle file use the latest version of google play services: 并在顶级gradle文件中使用最新版本的Google Play服务:
classpath 'com.google.gms:google-services:4.0.2'
Note: 注意:
You need to add the google() repo in the top level gradle file, as specified in the firebase docs and also it should be before jcenter(): 您需要按照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()
}
}
Please use the following version: 请使用以下版本:
implementation 'com.google.android.gms:play-services-ads:17.1.1'
Also update the firebase-core library to version 16.0.4
: 16.0.4
-core库更新到版本16.0.4
:
implementation 'com.google.firebase:firebase-core:16.0.4'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.