简体   繁体   中英

How do I match the Android Gradle version?

https://github.com/MobileSeoul/2016seoul-02

I opened open source on GitHub. However, the layout did not come out because the version was not correct in 'Gradle'. So when I did a search, I could see the advice of "keep the gradle numbers up to date". But I do not know how to set the Latest gradle number. Where can I find the Latest number?


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


apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 23
    buildToolsVersion '26.0.2'

    defaultConfig {
        applicationId "com.runfive.hangangrunner"
        minSdkVersion 19
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }

    dexOptions {
        jumboMode true
        javaMaxHeapSize "2g"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
repositories {
    mavenCentral()
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:support-v4:23.4.0'
    compile 'com.android.support:design:23.4.0'
    //compile 'com.naver.maps.open:naver-map-api:2.1.2@aar' - Changed to Google Maps
    compile project(':decoviewlib')
    compile project(':calendarlib')
    compile 'com.google.android.gms:play-services:9.0.2'
    compile 'com.google.android.gms:play-services:7.5.+'
    //compile 'com.google.android.gms:play-services-maps:9.4.0'
    //compile 'com.google.android.gms:play-services:9.4.0'
    compile 'com.google.maps.android:android-maps-utils:0.4'
    compile 'com.squareup.okhttp:okhttp:2.7.2'
    compile 'com.google.code.gson:gson:2.6.2'
    // dailyfragment에서 씀

    // Facebook interlocking
    compile 'com.facebook.android:facebook-android-sdk:4.6.0'

    // Login with Naver
    compile files('libs/3rdparty_login_library_android_4.1.4.jar')

    // Card view
    compile 'com.android.support:recyclerview-v7:23.4.0'
    compile 'com.android.support:cardview-v7:23.4.0'

    // font
    compile 'com.tsengvn:Typekit:1.0.0'

    // Subversion Support
    compile 'com.android.support:multidex:1.0.0'
}

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        google()
    }
   dependencies {
       classpath 'com.android.tools.build:gradle:3.0.1'
       classpath 'com.android.tools.build:gradle:1.3.0-beta1'
       classpath 'com.google.gms:google-services:1.3.0-beta1'

      // NOTE: Do not place your application dependencies here; they belong
      // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

I suggest you take a look at this answer for more details

As of Android studio 3.0, it becomes much easier as it now shows a more helpful hint, so we only need to follow this hint.
for example: 2]

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

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.)

Solution:
Add explicitly the library with the old version but with a new version number.
in my case com.android.support:customtabs:26.1.0 so I need to add:

implementation "com.android.support:cardview-v7:27.0.2"

Note: don't forget to press sync now so gradle can rebuild the dependency graph and see if there are any more conflicts.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM