2017-04-09 28 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' 
    
相關問題