android - Build.Gradle 中的库版本错误
问题描述
如果我添加implementation 'com.google.android.gms:play-services-analytics:16.0.1'
到我的应用程序 build.gradle 我在该行和implementation 'com.android.support:appcompat-v7:27.1.1'
All com.android.support libraries must use the exact same version
specification (mixing versions can lead to runtime crashes). Found versions
27.1.1, 26.1.0. Examples include com.android.support:animated-vector-
drawable:27.1.1 and com.android.support:support-media-compat:26.1.0
All gms/firebase libraries must use the exact same version specification
(mixing versions can lead to runtime crashes). Found versions 16.0.1, 16.0.0,
15.0.1. Examples include com.google.android.gms:play-services-
analytics:16.0.1 and com.google.android.gms:play-services-measurement-
base:16.0.0
我怎么解决这个问题??我试图手动编辑库的版本,但我仍然遇到同样的问题。
这是我的 Build.Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.domain.app"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
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'
compile 'com.android.support:recyclerview-v7:27.1.1'
compile 'com.android.support:cardview-v7:27.1.1'
compile 'com.facebook.stetho:stetho:1.4.2'
implementation 'com.google.android.gms:play-services-analytics:16.0.1'
}
解决方案
更改所有Gradle文件(包括导入的项目)中的库版本。之后清理并重建项目。如果您仍然收到错误,请忽略它,因为它不会影响您的应用程序。
推荐阅读
- android - 在发布模式下启用 Proguard 后 Firebase 应用内消息崩溃
- sql-server - 如何重命名 SQL Server 2016 数据库,包括物理文件,即 .mdf 和 .log 文件
- javascript - 比较 JavaScript 中对象数组的两个参数
- javascript - 我怎样才能承诺一个 AJAX 请求 onreadystatechange?
- python-3.x - 打印函数结果 python2 正确但 python3 错误
- android-studio - 将 Android Studio 更新到 3.3 后,Crashlytics 无法正常工作
- java - 记录未从 JTable java netbeans 上的数据库中加载
- ios - 具有后台模式的 React Native 可操作推送通知
- apache-kafka - 这可能吗?生产者 batch.size * max.request.size > broker max.message.bytes
- java - 如何使用 Unirest 将数据从 Vaadin 发布到 Vertx?