所有android支持库必须使用相同的版本规范 [英] All android support libraries must use the same version specification

查看:239
本文介绍了所有android支持库必须使用相同的版本规范的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道我哪里出错了,但是这让我继续说:

 所有com.android.support库必须使用相同的确切版本规范(混合版本可能会导致运行时崩溃)。发现版本24.0.0,23.2.0示例包括com.android.support:animated-vector-drawable:24.0.0和com.android.support:cardview-v7 :23.2.0 

我的build.gradle是

  apply plugin:'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion '25 .0.0'

defaultConfig {
applicationIdcom.example.project
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName1.0
multiDexEnabled true

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguar d-rules.pro'
}
}
}

所有项目{
gradle.projectsEvaluated {
tasks.withType(JavaCompile){
options.compilerArgs<< -Xlint:未选中<< -Xlint:deprecation
}
}
}

依赖关系{
编译fileTree(dir:'libs',include:['*。 jar'])
testCompile'junit:junit:4.12'
compile'c​​om.parse.bolts:bolts-android:1. +'
compile'c​​om.parse:parse-android: 1. +'
compile'c​​om.android.support:appcompat-v7:23.2.0'
compile'c​​om.android.support:design:23.2.0'
compile'c​​om。 android.support:recyclerview-v7:23.2.0'
compile'c​​om.android.support:cardview-v7:23.2.0'
compile'c​​om.squareup.picasso:picasso:2.5.2'
compile'c​​om.mani:ThinDownloadManager:1.2.2'
compile'net.rdrei.android.dirchooser:library:3.2@aar'
compile'c​​om.google.android.gms: play-services:10.2.0'
compile'c​​om.onesignal:OneSignal:3。+ @ aar'

}
apply plugin:'com.google.gms.google -services'

它也显示了这一行中的错误

  compile'c​​om.android.support:appcompat-v7:23.2.0'

我试着将compileSdkVersion更改为24,但似乎目前没有任何工作。事实上,在引入Play服务库之前,一切工作都正常。

解决方案

这个依赖使用com.android的版本24.0.0 .support:animated-vector-drawable:

  compile'c​​om.google.android.gms:play-services:10.2.0 '

这会导致android studio抱怨它可能导致错误/崩溃,因为所有的版本谷歌库不匹配。



所以你有两个选择: (我知道我的头顶)


  1. 将您的 compileSdkVersion 更改为24并全部更改你的支持库依赖到版本24,以及匹配play-services依赖:

    pre $ compile $ com.android.support:appcompat -v7:24.0.0'
    compile'c​​om.android.support:design:24.0.0'
    compile'c​​om.android.support:recyclerview-v7:24.0.0'
    compile 融为一体。 android.support:cardview-v7:24.0.0'


  2. 降级 com.google.android.gms:play-services 改为9.4或9.2.1,以便它不使用任何版本的24。这仍然需要你的支持库从23.2.0轻微改变为23.0.0

      compile'c​​om.android.support :appcompat-v7:23.0.0'
    compile'c​​om.android.support:design:23.0.0'
    compile'c​​om.android.support:recyclerview-v7:23.0.0'
    编译'com.android.support:cardview-v7:23.0.0'
    编译'com.google.android.gms:play-services:9.4.0'



I dont know where I went wrong, but this keeps me saying

All com.android.support libraries must use the same exact version specification (mixing versions can lead to runtime crashes.) Found versions 24.0.0,23.2.0 Examples include com.android.support:animated-vector-drawable:24.0.0 and com.android.support:cardview-v7:23.2.0

my build.gradle is

        apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion '25.0.0'

    defaultConfig {
        applicationId "com.example.project"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

allprojects {
    gradle.projectsEvaluated {
        tasks.withType(JavaCompile) {
            options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.parse.bolts:bolts-android:1.+'
    compile 'com.parse:parse-android:1.+'
    compile 'com.android.support:appcompat-v7:23.2.0'
    compile 'com.android.support:design:23.2.0'
    compile 'com.android.support:recyclerview-v7:23.2.0'
    compile 'com.android.support:cardview-v7:23.2.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.mani:ThinDownloadManager:1.2.2'
    compile 'net.rdrei.android.dirchooser:library:3.2@aar'
    compile 'com.google.android.gms:play-services:10.2.0'
    compile 'com.onesignal:OneSignal:3.+@aar'

}
apply plugin: 'com.google.gms.google-services'

It shows error in this line too

compile 'com.android.support:appcompat-v7:23.2.0'

I tried changing compileSdkVersion to 24 too, but nothing seems to work as of now. Actually everything was working fine before I introduced the play services library.

解决方案

This dependency is using version 24.0.0 of com.android.support:animated-vector-drawable:

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

which will cause android studio to complain that it could lead to bugs/crashes because versions of all your google libraries don't match.

So you have 2 options: (that I know of off the top of my head)

  1. Change your compileSdkVersion to 24 and change all your support library dependencies to version 24 as well to match the play-services dependencies:

    compile 'com.android.support:appcompat-v7:24.0.0'
    compile 'com.android.support:design:24.0.0'
    compile 'com.android.support:recyclerview-v7:24.0.0'
    compile 'com.android.support:cardview-v7:24.0.0'
    

  2. Downgrade com.google.android.gms:play-services to 9.4 or 9.2.1 so that it doesn't use version 24 of anything. This still requires a minor change to your support libraries from 23.2.0 to simply 23.0.0

    compile 'com.android.support:appcompat-v7:23.0.0'
    compile 'com.android.support:design:23.0.0'
    compile 'com.android.support:recyclerview-v7:23.0.0'
    compile 'com.android.support:cardview-v7:23.0.0'
    compile 'com.google.android.gms:play-services:9.4.0'
    

这篇关于所有android支持库必须使用相同的版本规范的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆