将依赖项“ com.google.android.gms:play-services-location:15.0.1”添加到“ com.android.support:appcompat-v7:28.0.0”时遇到错误

时间:2018-09-29 20:05:43

标签: android dependencies google-play-services android-appcompat

添加依赖项“ com.google.android.gms:play-services-location:15.0.1 ”后,它显示“ com.android.support:appcompat-v7”错误: 28.0.0 ” 它显示所有com.android.support库必须使用完全相同的版本规范。

我的依赖关系如下:

 <a href="xxx">
    <amp-fx-flying-carpet height="300px">
     <amp-img src="images.jpg" width="500" height="500" layout="responsive"></amp-img>
    </amp-fx-flying-carpet>
</a>

错误是:

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation `com.android.support:appcompat-v7:28.0.0`
implementation `com.android.support:design:28.0.0`
implementation `com.android.support.constraint:constraint-layout:1.1.3`
//GMS Services for location
implementation `com.google.android.gms:play-services-location:15.0.1`

如果我删除了gms依赖关系,则appcompact库的错误已消失。任何解决方案将不胜感激。

2 个答案:

答案 0 :(得分:0)

解决方案:

在您的gradle中将这些行添加为依赖项

def support_libraries = "28.0.0"

implementation "com.android.support:appcompat-v7:$support_libraries"
implementation "com.android.support:design:$support_libraries"
implementation "com.android.support:support-compat:$support_libraries"

如果这行不通,我建议您使用其他解决方案。

答案 1 :(得分:0)

已经在这里回答:https://stackoverflow.com/a/52571055/4409113

Found versions 28.0.0, 26.1.0. Examples include com.android.support:animated-vector-drawable:28.0.0 and com.android.support:media-compact-26.1.0.

尝试添加:

implementation 'com.android.support:support-media-compat:28.0.0'

在您的Build.gradle依赖项中。

相关问题