optimize build

This commit is contained in:
Milos Kozak 2022-11-11 19:27:47 +01:00
parent 8c44879150
commit 20e07cb656
4 changed files with 34 additions and 13 deletions

View file

@ -107,3 +107,18 @@ subprojects {
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1 maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
} }
} }
// This is necessary to prevent Gradle build errors like:
//
// Duplicate class androidx.lifecycle.ViewModelLazy found in modules jetified-lifecycle-viewmodel-ktx-2.3.1-runtime (androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1) and lifecycle-viewmodel-2.5.0-runtime (androidx.lifecycle:lifecycle-viewmodel:2.5.0)
//
// By explicitly adding these dependencies, the jetifier
// is forced to use the correct lifecycle version instead
// of automatically picking 2.3.1.
//
// See: https://stackoverflow.com/a/69832319/560774
configurations {
all {
exclude group: 'androidx.lifecycle', module: 'lifecycle-viewmodel-ktx'
}
}

View file

@ -25,16 +25,4 @@ android {
dependencies { dependencies {
kapt "com.google.dagger:dagger-android-processor:$dagger_version" kapt "com.google.dagger:dagger-android-processor:$dagger_version"
kapt "com.google.dagger:dagger-compiler:$dagger_version" kapt "com.google.dagger:dagger-compiler:$dagger_version"
// This is necessary to prevent Gradle build errors like:
//
// Duplicate class androidx.lifecycle.ViewModelLazy found in modules jetified-lifecycle-viewmodel-ktx-2.3.1-runtime (androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1) and lifecycle-viewmodel-2.5.0-runtime (androidx.lifecycle:lifecycle-viewmodel:2.5.0)
//
// By explicitly adding these dependencies, the jetifier
// is forced to use the correct lifecycle version instead
// of automatically picking 2.3.1.
//
// See: https://stackoverflow.com/a/69832319/560774
implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
} }

View file

@ -7,11 +7,14 @@ plugins {
} }
apply from: "${project.rootDir}/core/core-main/android_dependencies.gradle" apply from: "${project.rootDir}/core/core-main/android_dependencies.gradle"
apply from: "${project.rootDir}/core/core-main/android_module_dependencies.gradle"
android { android {
namespace 'info.nightscout.database.entities' namespace 'info.nightscout.database.entities'
buildFeatures {
buildConfig = false
}
} }
dependencies { dependencies {

View file

@ -133,3 +133,18 @@ dependencies {
repositories { repositories {
mavenCentral() mavenCentral()
} }
// This is necessary to prevent Gradle build errors like:
//
// Duplicate class androidx.lifecycle.ViewModelLazy found in modules jetified-lifecycle-viewmodel-ktx-2.3.1-runtime (androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1) and lifecycle-viewmodel-2.5.0-runtime (androidx.lifecycle:lifecycle-viewmodel:2.5.0)
//
// By explicitly adding these dependencies, the jetifier
// is forced to use the correct lifecycle version instead
// of automatically picking 2.3.1.
//
// See: https://stackoverflow.com/a/69832319/560774
configurations {
all {
exclude group: 'androidx.lifecycle', module: 'lifecycle-viewmodel-ktx'
}
}