android - gms:play-services-ads:17.1.1 给出错误所有 com.google.android.gms 库必须使用完全相同的版本规范
问题描述
所有 com.google.android.gms 库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。
找到版本 17.1.2、16.0.5、16.0.4、16.0.1、16.0.0。示例包括 com.google.android.gms:play-services-ads-base:17.1.2 和 com.google.android.gms:play-services-measurement-base:16.0.5
这是我正在使用的 gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.hoper.friebasecrashalytics"
minSdkVersion 14
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.0.2'
compile "com.android.support:exifinterface:26.0.2"
compile 'com.android.support:animated-vector-drawable:26.0.2'
//compile 'com.google.firebase:firebase-core:16.0.5'
compile 'com.google.android.gms:play-services-ads:17.1.1'
//compile 'com.crashlytics.sdk.android:crashlytics:2.9.6'
testCompile 'junit:junit:4.12'
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '26.0.2'
}
}
}
}
apply plugin: 'com.google.gms.google-services'
即使我们不使用 firebase 也会发生错误
我们如何解决这个问题
解决方案
检查警告中显示了哪些库,并使用相同的版本号实现它们。例如:
警告显示:
com.android.support:customtabs:xx.xx
你需要实现:
implementation 'com.android.support:customtabs:28.0.0'
推荐阅读
- python - 从同一网络上的另一台计算机(烧瓶 python 服务器)访问 localhost?
- python - 在 AVAudioPlayer,iOS 中从 UDP 套接字播放 int16 pyaudio bytearray
- reactjs - 暴露静态引用的嵌套反应钩子
- r - 仅显示每 N 天的数据标签,并在 R ggplot 中突出显示特定变量的一行
- python - 将字典传递到 SQLAlchemy 选择语句的 where 子句
- django - 同一视图django中的多个查询模型
- excel - 具有路径的特定部分作为变量的 Excel vba 函数
- c# - C# Linq 查询。日期之间的日期不起作用
- woocommerce - 在 WooCommerce 单品页面上显示 ACF 字段
- laravel - Laravel Passport - 功能测试返回未经授权的 401