Skip to content

Instantly share code, notes, and snippets.

@s0nerik
Last active May 16, 2023 14:46
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save s0nerik/a6db75683f4796ec6e463740b8262e43 to your computer and use it in GitHub Desktop.
Save s0nerik/a6db75683f4796ec6e463740b8262e43 to your computer and use it in GitHub Desktop.
Android multi-module Gradle setup example
plugins {
id("com.android.application")
}
android {
defaultConfig {
applicationId = "com.example.task"
versionCode = 1
versionName = "1.0"
}
}
dependencies {
implementation(project(":player"))
}
apply {
plugin("com.android.library")
}
dependencies {
implementation("com.google.android.exoplayer:exoplayer:2.9.6")
}
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:${Versions.androidGradlePlugin}")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}")
}
}
allprojects {
repositories {
google()
jcenter()
}
}
subprojects {
if (name == "app") {
apply plugin: "com.android.application"
} else {
apply plugin: "com.android.library"
}
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion(Versions.compileSdk)
defaultConfig {
minSdkVersion(Versions.minSdk)
targetSdkVersion(Versions.targetSdk)
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
dexOptions {
preDexLibraries = true
javaMaxHeapSize = "4g"
}
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
}
}
kapt {
useBuildCache = true
correctErrorTypes = true
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:${Versions.kotlin}")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.1")
implementation("androidx.core:core-ktx:1.0.1")
implementation("androidx.appcompat:appcompat:1.0.2")
implementation("org.koin:koin-androidx-viewmodel:2.0.0-beta-1")
testImplementation("junit:junit:4.12")
androidTestImplementation("androidx.test:runner:1.1.1")
androidTestImplementation("androidx.test.espresso:espresso-core:3.1.1")
}
}
tasks.register("clean", Delete) {
delete(rootProject.buildDir)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment