问题描述
我正在开发一个新应用.目前,我正在尝试添加依赖项.
I am working on a new app. Presently I am trying to add dependency.
implementation 'com.google.android.gms:play-services:11.0.1'
当我这样做时,在实现'com.android.support:appcompat-v7:27.1.1'上遇到了gradle编译错误,说:
When I do I get a gradle compile error on implementation 'com.android.support:appcompat-v7:27.1.1' saying:
所有com.android.support库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃).找到版本27.1.1、26.1.0.示例包括com.android.support:animated-vector-drawable:27.1.1和com.android.support:mediarouter-v7:26.1.0
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:mediarouter-v7:26.1.0
有什么想法可以最好地解决此问题吗?
Any ideas how to best resolve this issue?
成绩文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.boulbabazitouni.getdevicelocation_time"
minSdkVersion 21
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(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-vector-drawable:27.1.1'
implementation 'com.android.support:mediarouter-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
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'
implementation 'com.google.android.gms:play-services:11.0.1'
}
推荐答案
问题是您在此库中有一些临时依赖项.每当发生这种情况时,您都可以显式添加有冲突的依赖项,并将其与当前版本相匹配:
The problem is that you have some transient dependencies in this libraries. Whenever this happens you can explicitly add the conflicting dependencies and match them with your current version:
implementation 'com.android.support:animated-vector-drawable:27.1.1'
implementation 'com.android.support:mediarouter-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
这篇关于appcompat-v7:27.1.1与播放服务冲突:11.0.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!