Skip to content

Instantly share code, notes, and snippets.

@lamvann
Last active May 25, 2020 19:12
Show Gist options
  • Save lamvann/68319e15fc393a7117a329e99bdcb428 to your computer and use it in GitHub Desktop.
Save lamvann/68319e15fc393a7117a329e99bdcb428 to your computer and use it in GitHub Desktop.
Extension function on Project object to set up an android library
fun Project.setupAsAndroidLibrary() {
println("\tAndroid Library")
apply(plugin = "com.android.library")
apply(plugin = "org.jetbrains.kotlin.android")
apply(plugin = "org.jetbrains.kotlin.android.extensions")
apply(plugin = "org.jetbrains.kotlin.kapt")
configure<com.android.build.gradle.LibraryExtension> {
compileOptions {
sourceCompatibility = VERSION_1_8
targetCompatibility = VERSION_1_8
}
compileSdkVersion(28)
buildToolsVersion = "28.0.3"
defaultConfig {
minSdkVersion(23)
targetSdkVersion(28)
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
versionName = version.toString()
}
dataBinding {
isEnabled = true
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment