微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android – appcompat-v7:25.2.0与play-services冲突:10.2.1

我正在开发一款新应用.目前我正在尝试添加依赖项

compile 'com.google.android.gms:play-services:10.2.1'

当我这样做时,编译’com.android.support:appcompat-v7:25.2.0’得到一个gradle编译错误说:

All com.android.support libraries must use the exact same version
specification (mixing versions can lead to runtime crashes). Found
versions 25.2.0, 24.0.0. Examples include
com.android.support:animated-vector-drawable:25.2.0 and
com.android.support:mediarouter-v7:24.0.0 less… (⌘F1) There are some
combinations of libraries, or tools and libraries, that are
incompatible, or can lead to bugs. One such incompatibility is
compiling with a version of the Android support libraries that is not
the latest version (or in particular, a version lower than your
targetSdkVersion.)

任何想法如何最好地解决这个问题?

Gradle文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "appIdhere"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        resValue "string", "authority", "${applicationId}"
    }
    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'
    })

    provided "org.projectlombok:lombok:1.16.8"
    compile 'com.android.support:appcompat-v7:25.2.0'
    compile 'com.android.support:design:25.2.0'
    compile 'com.android.support:recyclerview-v7:25.2.0'
    compile 'com.android.support:cardview-v7:25.2.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:support-v4:25.2.0'
    compile 'com.squareup.okhttp:okhttp:2.7.0'
    compile 'com.google.android.gms:play-services:10.2.1'
    testCompile 'junit:junit:4.12'
}

解决方法:

使用以下命令更新build.gradle文件:

编译’com.android.support:appcompat-v7:25.3.1′

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐