Last active
May 16, 2023 14:46
-
-
Save s0nerik/a6db75683f4796ec6e463740b8262e43 to your computer and use it in GitHub Desktop.
Android multi-module Gradle setup example
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
plugins { | |
id("com.android.application") | |
} | |
android { | |
defaultConfig { | |
applicationId = "com.example.task" | |
versionCode = 1 | |
versionName = "1.0" | |
} | |
} | |
dependencies { | |
implementation(project(":player")) | |
} |
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
apply { | |
plugin("com.android.library") | |
} | |
dependencies { | |
implementation("com.google.android.exoplayer:exoplayer:2.9.6") | |
} |
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
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