BUG描述:
Android Studio 4.1 创建application module 和 多个libraury module,并且在application module引入libraury module independency时出现:
Execution failed for task ':app:mergeDexDebug'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Failed to transform classes.jar (project :mylibrary) to match attributes {artifactType=android-dex, com.android.build.api.attributes.BuildTypeAttr=debug, com.android.build.api.attributes.VariantAttr=debug, dexing-enable-desugaring=true, dexing-incremental-transform=false, dexing-is-debuggable=true, dexing-min-sdk=19, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime, org.jetbrains.kotlin.platform.type=androidJvm}.
> Could not isolate parameters com.android.build.gradle.internal.dependency.AarToClassTransform$Params_Decorated@7c88e18d of artifact transform AarToClassTransform
> Current thread does not hold the state lock for project :app
解决方法:
将每个module下的 build.gradle里的android标签里的compileOptions标签注释掉
android {
// compileOptions {
// sourceCompatibility JavaVersion.VERSION_1_8
// targetCompatibility JavaVersion.VERSION_1_8
// }
}
版权声明:本文为halong99原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。