천복만복 프로그래밍/천복만복 안드로이드
Execution failed for task ':app:mergeDebugAndroidTestJavaResource'. > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade > More than one file was found with OS independent path 'META-INF/AL2.0'.
U&MeBlue
2022. 2. 13. 15:45
안드로이드 테스트를 공부하던 와중에 에러가 발생했다. 다음과 같이 코루틴 테스팅 관련 dependency 를 추가한 뒤 빌드하는 과정에서 에러가 발생했다.
문제를 일으킨 Dependency
androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion"
에러 코드
Execution failed for task ':app:mergeDebugAndroidTestJavaResource'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> More than one file was found with OS independent path 'META-INF/AL2.0'.
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:mergeDebugAndroidTestJavaResource'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:205)
at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:263)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:203) ...
문제가 되는 코루틴 라이브러리와 특정 dependency 를 함께 사용하는 경우에 동일한 파일이 merge 되어 발생하는 문제 정도로 이해되고, 정확한 원인은 모르겠다. 코루틴 팀이 제안한 공식적인 해결방법은 다음 링크에서 확인할 수 있다.
https://github.com/Kotlin/kotlinx.coroutines/issues/2023#issuecomment-858644393
Compilation error on the androidTest configuration after updating to 1.3.6 · Issue #2023 · Kotlin/kotlinx.coroutines
The compilation error occurs after updating to 1.3.6, and it gets fixed if I downgrade to 1.3.5. Kotlin Version 1.3.72 The coroutines dependencies I am using are: implementation platform("org....
github.com
여기서 간단히 적으면 다음 gradle 코드를 gradle 파일의 android block 에 추가하는 것이다.
android {
// 나의 경우에 다음 2줄만 추가해도 해결이 되었다.
packagingOptions {
// for JNA and JNA-platform
exclude "META-INF/AL2.0"
exclude "META-INF/LGPL2.1"
}
}
728x90