Last active
August 29, 2015 14:05
-
-
Save Jween/ebbb7e4a9bb970714d7d to your computer and use it in GitHub Desktop.
detect android gradle plugin version by gradle version, solve the dependency issues
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Top-level build file where you can add configuration options common to all sub-projects/modules. | |
buildscript { | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
// com.android.tools.build:gradle:0.6.+ -> gradle 1.8 | |
// com.android.tools.build:gradle:0.7.+ -> gradle 1.9 | |
// com.android.tools.build:gradle:0.8.+ -> gradle 1.9/1.10 | |
// com.android.tools.build:gradle:0.9.+ -> gradle 1.10/1.11 | |
// com.android.tools.build:gradle:0.10.+ -> gradle 1.10/1.11/1.12 | |
// com.android.tools.build:gradle:0.11.+ -> gradle 1.10/1.11/1.12 | |
// com.android.tools.build:gradle:0.12.+ -> gradle 1.10/1.11/1.12 | |
// com.android.tools.build:gradle:0.13.+ -> gradle 1.12 / 2.1 | |
// | |
// Android Studio 0.3.x -> gradle-plugin 0.6 | |
// Android Studio 0.4.x -> gradle-plugin 0.7 | |
// Android Studio 0.4.3+ -> gradle-plugin 0.8 | |
// Android Studio 0.5.x -> gradle-plugin 0.9 | |
// Android Studio 0.5.8 -> gradle-plugin 0.9.+ or 0.10.+ | |
// Android Studio 0.5.9 -> gradle-plugin 0.9.+ or 0.10.4+ | |
// Android Studio 0.6.x -> gradle-plugin 0.11.+ | |
// Android Studio 0.8.x -> gradle-plugin 0.12.+ | |
// | |
// gradle 1.12 requires Android Studio 0.5.8+ | |
def abtPath = 'com.android.tools.build:gradle:0.5.+' | |
switch(gradle.gradleVersion) { | |
case ['1.4', '1.5', '1.6', '1.7', '1.8']: | |
abtPath = 'com.android.tools.build:gradle:0.5.+' | |
break; | |
case ['1.9']: | |
abtPath = 'com.android.tools.build:gradle:0.8.+' | |
break; | |
case ['1.10', '1.11']: | |
abtPath = 'com.android.tools.build:gradle:0.11.+' | |
break; | |
case '1.12': | |
abtPath = 'com.android.tools.build:gradle:0.12.+' | |
break; | |
case '2.1': | |
abtPath = 'com.android.tools.build:gradle:0.13.+' | |
break; | |
} | |
println "gradle version is ${gradle.gradleVersion}, " + | |
"android build tool is ${abtPath}" | |
classpath abtPath | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment