Skip to content

Instantly share code, notes, and snippets.

@SerggioC
Last active April 30, 2018 15:13
Show Gist options
  • Save SerggioC/b8508596adf40c92a89c211dbe9e3de5 to your computer and use it in GitHub Desktop.
Save SerggioC/b8508596adf40c92a89c211dbe9e3de5 to your computer and use it in GitHub Desktop.
build.gradle (app module) optimized template
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.example.android.mygarden"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
}
}
// Use keys in gradle.properties. Add to .gitignore
// get key in Java: BuildConfig.SOME_API_KEY
// get key in Java: BuildConfig.ANOTHER_API_KEY
buildTypes.each {
it.buildConfigField 'String', 'SOME_API_KEY', SomeApiKey
it.buildConfigField 'String', 'ANOTHER_API_KEY', AnotherApiKey
}
// use Java 8 Lambdas
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
// Google's Maven Repository Version Tracking
// https://dl.google.com/dl/android/maven2/index.html
// use double quotes "
ext {
supportlibversion = "27.1.1"
constraintLayoutVersion = "1.1.0"
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "com.android.support:appcompat-v7:$supportlibversion"
implementation "com.android.support:design:$supportlibversion"
implementation "com.android.support:recyclerview-v7:$supportlibversion"
implementation "com.android.support.constraint:constraint-layout:$constraintLayoutVersion"
implementation "com.android.support.constraint:constraint-layout-solver:$constraintLayoutVersion"
implementation "com.jakewharton.timber:timber:4.5.0"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment