pbandk
pbandk copied to clipboard
Kotlin Modules file name is too generic creating incompatibility with other libraries
When using this library in combination with androidx.compose.runtime:runtime
the following issue occurs:
Execution failed for task ':app:mergeDevWithDetoxReleaseJavaResource'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeJavaResWorkAction
> 2 files found with path 'META-INF/runtime_release.kotlin_module' from inputs:
- /home/runner/.gradle/caches/transforms-3/8f65bf2d119256e7e77373afc0231832/transformed/jetified-runtime-1.0.4/jars/classes.jar
- /home/runner/.gradle/caches/transforms-3/5d414adf6ad78335c9cb13fbd3ae99d5/transformed/jetified-runtime-release/jars/classes.jar
Adding a packagingOptions block may help, please refer to
https://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.PackagingOptions.html
for more information
https://stackoverflow.com/questions/44509608/duplicate-files-copied-in-apk-meta-inf-library-release-kotlin-module
This SO post seems to suggest the following to fix this:
ext {
GROUP_ID = 'custom.group.id'
ARTIFACT_ID = 'artifactid'
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
compileOptions {
kotlinOptions.freeCompilerArgs += ['-module-name', "$GROUP_ID.$ARTIFACT_ID"]
}
defaultConfig {
...
}
buildTypes {
...
}
}
Hi @matthewslade. Sorry for the delayed reply here. Which version of the Android Gradle Plugin are you using? https://youtrack.jetbrains.com/issue/KT-49066 seems to imply that this conflict shouldn't happen with newer AGP versions.