Skip to content

Instantly share code, notes, and snippets.

@litmon
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save litmon/08ff67f553cb47b0eff0 to your computer and use it in GitHub Desktop.
Save litmon/08ff67f553cb47b0eff0 to your computer and use it in GitHub Desktop.
build-toolsを自動で設定する
apply plugin: 'com.android.application'
def getSdkDir() {
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def sdkDir = properties.getProperty('sdk.dir', null)
if (sdkDir == null)
throw new GradleException("SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_SDK_ROOT environment variable.")
return sdkDir
}
def buildToolsList(){
new File(getSdkDir(), 'build-tools').list().sort { a, b -> b <=> a }
}
def latestBuildTools(){
buildToolsList()[0]
}
android {
compileSdkVersion 22
buildToolsVersion latestBuildTools()
defaultConfig {
applicationId "com.litmon.build-tools-automation"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment