添加google plya-services时,所有com.android.support库都必须使用完全相同的版本规范
在添加google play-services
库时,我可以在地图中添加此错误:
When adding google play-services
library so I can add in a map I got this error:
所有com.android.support库必须使用完全相同的版本规范
all com.android.support libraries must use the exact same version specification
我的依赖项如下:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.android.gms:play-services:+'
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 'de.hdodenhof:circleimageview:2.1.0'
}
我尝试更改android support
版本和android play services
版本,但错误仍然存在.
I tried to change the android support
version as well as the android play services
version, but the error remained.
使用恒定版本,删除+
:
implementation 'com.google.android.gms:play-services:15.0.1'
还要避免添加整个API,仅选择所需的API,就可以找到它们这里.例如,如果您知道只需要Google Maps,则只需添加以下内容:
And also avoid adding the whole API, choose only the one that you need, you can find them here. For example, if you know you will only need Google Maps then just add this:
implementation 'com.google.android.gms:play-services-maps:15.0.1'
而不是像您一样整个事情.
Instead of the whole thing like you did.
将此添加到您的项目构建gradle文件(而不是模块1):
Add this to your project build gradle file (not the module one):
repositories {
maven {
url "https://maven.google.com"
}
}