我收到此错误
6:11 PM Gradle sync失败:无法通知依赖项解析 监听器。 com [go.google.android.gms:play-services-basement库正在[[11.0.4,11.0.4]的各种其他图书馆请求, [15.0.1,15.0.1]],但解析为15.0.1。禁用插件并检查 你的依赖树使用./gradlew:app:dependencies
的build.gradle(项目)
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'io.fabric.tools:gradle:1.25.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.0.0'
// classpath 'com.google.gms:google-services:3.2.0'
}
}
allprojects {
// ...
repositories {
// ...
maven {
url 'https://maven.google.com/'
}
}
repositories {
// ...
google() // Google's Maven repository
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
的build.gradle(模块:应用)
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 26
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.neoline.whrilloprovider"
minSdkVersion 17
targetSdkVersion 26
vectorDrawables.generatedDensities = ['hdpi', 'xxhdpi']
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled = true
vectorDrawables.useSupportLibrary = true
}
aaptOptions {
additionalParameters '— no-version-vectors'
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/ASL2.0'
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.0.2'
// implementation 'com.google.android.gms:play-services-maps:11.6.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
// compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.google.android.gms:play-services:11.0.4'
compile 'com.android.support:multidex:1.0.2'
compile 'com.android.support:recyclerview-v7:26.0.2'
testCompile 'junit:junit:4.12'
compile 'com.google.firebase:firebase-core:16.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.1'
implementation 'com.squareup.picasso:picasso:2.3.2'
compile('com.crashlytics.sdk.android:crashlytics:2.9.0@aar') {
transitive = true
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
google()
}
}
apply plugin: 'com.google.gms.google-services'
答案 0 :(得分:0)
您不应该包含com.google.android.gms:play-services:X.X.X
。这样做会吸引所有Google Play服务API,使您的APK大于所需数量并增加构建时间。相反,只包括您需要的API,如Setup Instructions。
您还必须使用兼容版本的Firebase和Play服务库。如果您要使用firebase-core:16.0.0
,请使用最新版本的Play服务API。它们列在上面链接的安装说明的表1中。大多数是15.0.1;一些是15.0.2。如果其他依赖项或代码强制您使用play-services-xxx:11.0.4
,请使用firebase-core:11.0.4
。请注意,这些版本为nearly a year old。
答案 1 :(得分:0)
将GTM documentation中所述的Google跟踪代码管理器v.11.0.4添加到我的项目后,我遇到了同样的错误。在此之前,我已经在项目中添加了Firebase Analytics v.16.0.1。版本11.0.4。 GTM的历史悠久。您可以在maven repository中查找当前版本。
将Google跟踪代码管理器升级到16.0.1解决了我的问题。