-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Compilation error on the androidTest configuration after updating to 1.3.6 #2023
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I found 2 workarounds:
|
Thanks @dmarin. Just by putting: packagingOptions { Already did the trick |
Could you please provide a reference to a reproducing Android project? Unfortunately, I cannot reproduce this build failure on simple projects |
getting similar error on androidTest > More than one file was found with OS independent path 'META-INF/AL2.0'
and Above suggestions do help on the problem when compiling for AndroidTest. In case of multi-module setup, the exclude of the dependency should be applied to all the modules. Kotlin coroutines upgraded to 1.3.6 |
I can reproduce part of the problem on a brand new project created from AS. Steps:
Notes: @qwwdfsad Is this enough? or should I publish the repo reproducing the issue somewhere? |
That's enough, thanks! |
Seems to be related to a newer version of bytebuddy.
|
This issue still persists in 1.3.7 |
This issue still persists in 1.3.8 |
Looks like just excluding resolutionStrategy {
exclude group: "org.jetbrains.kotlinx", module: "kotlinx-coroutines-debug"
} |
@francescocervone That's what i got when i tried your solution: No signature of method: build_2bz6cqdgyzucl8y9x7vl21swb.android() is applicable for argument types: (build_2bz6cqdgyzucl8y9x7vl21swb$_run_closure1) values: [build_2bz6cqdgyzucl8y9x7vl21swb$_run_closure1@18b6ad15] The only thing that's working for me is: packagingOptions { |
Same problem. I get this not only on the
Any idea how long we gotta keep this around? Until the next coroutines version or? |
@francescocervone Thanks Ciccio! |
I've tracked the problem to be a conflict between the kotlinx-coroutines-debug package and mockito and how they include the ByteBuddy library. Mockito includes ByteBuddy as a dependency, however the coroutines-debug imbeds ByteBuddy directly. Seems the best solution is coroutines-debug switches to a dependency model or does something to ensure the embedded version will not conflict with other libraries. While mockito is the dependency that I hit, it is possible other libraries that depend ByteBuddy could generate this conflict. I'm working around the problem by excluding the debug library which is a drag along dependency that I am not using.
|
This issue still persists in 1.3.9 |
) Added instructions to work around #2023 Also, the answer to #2274 is now documented. Co-authored-by: Vsevolod Tolstopyatov <[email protected]>
Using byte-buddy as a dependency instead of including it has other problems and wouldn't even solve this particular issue completely, so for now we've documented the workaround (the instructions have some details for those interested). Also, a feature request for the Android build tools that, if implemented, would fix this: https://issuetracker.google.com/issues/170131605 |
This issue still persists in 1.4.0 |
…tlin#2288) Added instructions to work around Kotlin#2023 Also, the answer to Kotlin#2274 is now documented. Co-authored-by: Vsevolod Tolstopyatov <[email protected]>
…tlin#2288) Added instructions to work around Kotlin#2023 Also, the answer to Kotlin#2274 is now documented. Co-authored-by: Vsevolod Tolstopyatov <[email protected]>
I updated all the |
On Kotlin Task that had this issue: :lib:mergeDebugAndroidTestJavaResource Fix was: pickFirst("win32-x86/attach_hotspot_windows.dll")
pickFirst("win32-x86-64/attach_hotspot_windows.dll")
pickFirst("META-INF/licenses/ASM") |
I prefer to skip all DLLs. Android does not support it anyway:
|
This issue still persists in 1.4.21 |
It's indeed is here, but unfortunately, there is nothing we can do about it. We've added a section about it to readme a few releases ago. |
I'm working on a Udacity/Kotlin/Android testing course UD940, lesson 11, and I am running into this error. The original is at Udacity's Github and I recommend you look at my code at this commit. I'm continuing to work on the course because of, and not despite this error; I think its a better example of what I may encounter in the wild than a nice, neat, well, planned lesson. |
Solved by following this |
The issue persists on v1.4.3, but can mitigate it meanwhile with the exclusion #2023 (comment) |
Sorry, I spoke too soon. Problem is still there. |
I'm closing this issue, this is an Android limitation and, unfortunately, we cannot do much about it. Please refrain from commenting that the issue is gone or still persists as it will only hide the workaround in the middle of the thread from people who first encountered it. Solution copied from our documentation: === Building an Android project that depends on The problem is that Android merges the resources of all its dependencies into a single directory and complains about
One possible workaround for these issues is to add the following to the packagingOptions {
// for JNA and JNA-platform
exclude "META-INF/AL2.0"
exclude "META-INF/LGPL2.1"
// for byte-buddy
exclude "META-INF/licenses/ASM"
pickFirst "win32-x86-64/attach_hotspot_windows.dll"
pickFirst "win32-x86/attach_hotspot_windows.dll"
} This will cause the resource merge algorithm to exclude the problematic license files altogether and only leave a single === |
Thanks @dmarin you are a life saver, I tried so many stack overflow solutions but they didn't worked but yours worked like a charm :) |
This comment has been minimized.
This comment has been minimized.
…win32-x86/attach_hotspot_windows.dll'." See Kotlin/kotlinx.coroutines#2023 for details and the documented workaround
…win32-x86/attach_hotspot_windows.dll'." See Kotlin/kotlinx.coroutines#2023 for details and the documented workaround
…win32-x86/attach_hotspot_windows.dll'." See Kotlin/kotlinx.coroutines#2023 for details and the documented workaround
Solved for version of Kotlin = 1.6.10 in build.gradle.kts |
1. mockito 라이브러리 추가 2. kotlinx-coroutines-debug에 의존되어 발생하는 파일 중첩 문제 수정 Kotlin/kotlinx.coroutines#2023
packagingOptions {
exclude "**/attach_hotspot_windows.dll"
exclude "META-INF/licenses/**"
exclude "META-INF/AL2.0"
exclude "META-INF/LGPL2.1"
} Why do these files cause compilation failures? They are not code files, so why do they affect the compilation results? |
@lisonge, they shouldn't affect the compilation results. They affect the linking results: putting everything into an archive fails, because the Android Gradle plugin can't decide which of the several files to include. As a result, we just exclude all of them, as none of them is useful in an Android project. |
android{ |
The compilation error occurs after updating to
1.3.6
, and it gets fixed if I downgrade to1.3.5
.Kotlin Version 1.3.72
The coroutines dependencies I am using are:
Stacktrace:
The text was updated successfully, but these errors were encountered: