2017-04-09 27 views
2

我不知道我哪里错了,但是这让我说所有Android支持库必须使用同一版本规范

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 

我的build.gradle是

 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:[email protected]' 
    compile 'com.google.android.gms:play-services:10.2.0' 
    compile 'com.onesignal:OneSignal:[email protected]' 

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

它显示的错误在这线也

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

我试着改变compileSdkVersion为24,但似乎没有任何工作,现在。事实上,在我推出游戏服务库之前,一切正常。

+1

什么是你的编译SDK版本?发布完整的gradle – rafsanahmad007

+0

Hi @ rafsanahmad007,我编辑了这篇文章。谢谢 –

+0

您的一个或多个依赖项请求Android支持库的某些部分,并请求该库的不同版本。您需要追踪哪个依赖关系(例如,通过Gradle依赖关系报告),然后解决问题(例如,通过为请求较新版本的传递依赖项添加自己的“编译”行)。 – CommonsWare

回答

2

这种依赖性正在使用的版本com.android.support:animated-vector-drawable 24.0.0:

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

这将导致Android Studio中抱怨说,它可能会导致因为版本的错误/崩溃你所有的谷歌图书馆都不匹配。

所以,你有2种选择:(据我所知,把我的头顶部)

  1. 更改compileSdkVersion 24,改变你的所有支持库依赖于版本24以及相匹配的播放服务依存关系:

    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. 降级com.google.android.gms:play-services到9.4或9.2.1,以便它不使用的24版任何东西。这仍然需要从23.2.0您的支持库,一个小的改动,以简单的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' 
    
相关问题