android - Gradle 版本冲突
问题描述
我的 build.gradle 很好,直到我尝试更新 sdk 版本(到 27)和 lib 版本。
在我的 build.gradle 中,我现在有:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
implementation 'com.google.firebase:firebase-crash:16.0.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
我收到一条错误消息:
Please fix the version conflict either by updating the version of the google-services plugin
(information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 15.0.1.
..但如您所见,它是 15.0.1。
我下面还有一条红色的下划线
implementation 'com.android.support:appcompat-v7:27.1.1'
当我将鼠标悬停时,我得到:
all support libraries must use the exact same version ... found versions 27.1.1 and 26.1.0
但我没有看到任何 26.1.0。
我究竟做错了什么?
解决方案
您需要更新您的主要 build.gradle 文件:
如果您使用的是 android studio 3.1.2,那么在您的 build.gradle 文件中应该如下所示:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// 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.1' // you need to update this most probably.
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
在你的模块的 build.gradle 文件中,你的implement
最新版本custom tabs
是27.1.1
'com.android.support:customtabs:27.1.1'
推荐阅读
- python - Python - 比较整个数据框给出的结果与单个元素不同
- r - lapply() 使用 XPath 获取特定标记后的所有文本不起作用
- javascript - 电子:将图像加载到新窗口
- reactjs - React Konva 绘制没有直径的半圆周
- flutter - Flutter:使用持久侧栏导航
- ruby-on-rails - Javascript 文件未在 Rails 开发中更新
- python - bmi 计算器给我错误的转换不知道为什么
- html - 我无法点击编辑和删除按钮
- spring - Spring Mongodb 聚合不适用于 DBRef
- python - 是否可以使用 Rosetta 翻译 URL?