Skip to content
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

duplicate entry: META-INF/atomicfu.kotlin_module #1064

Closed
SUPERCILEX opened this issue Mar 31, 2019 · 41 comments
Closed

duplicate entry: META-INF/atomicfu.kotlin_module #1064

SUPERCILEX opened this issue Mar 31, 2019 · 41 comments
Labels
Milestone

Comments

@SUPERCILEX
Copy link
Contributor

I've tried this and it doesn't work. I'm a bit stuck. 😢

@eakteam
Copy link

eakteam commented Mar 31, 2019

@SUPERCILEX , i have tried with

packagingOptions {
        pickfirst 'META-INF/atomicfu.kotlin_module'
}
packagingOptions {
        pickfirst 'META-INF/*'
}
packagingOptions {
        pickfirst '**'
}

and it is not working too !

@kherlopian2
Copy link

kherlopian2 commented Mar 31, 2019

packagingOptions {
        pickFirst 'META-INF/kotlinx-io.kotlin_module'
        pickFirst 'META-INF/atomicfu.kotlin_module'
        pickFirst 'META-INF/kotlinx-coroutines-io.kotlin_module'
    }

that worked with me.

@eakteam
Copy link

eakteam commented Mar 31, 2019

@kherlopian2 , for me still not working. I mean it's OK in Debug build, but not in release

@SUPERCILEX
Copy link
Contributor Author

@kherlopian2 Nope, not working. 😢 @eakteam Are you using dynamic feature feature modules or instant apps?

@eakteam
Copy link

eakteam commented Mar 31, 2019

@SUPERCILEX , Yes i am using Dynamic Feature Modules and this packaging options rules i have added in every build.gradle

@SUPERCILEX
Copy link
Contributor Author

Neat, so that's gotta be the bug somehow! I want to hear @qwwdfsad's thoughts, but then I'll file an issue if it's really Google's fault.

@eakteam
Copy link

eakteam commented Mar 31, 2019

@SUPERCILEX , sure that this is a minor bug and for sure it will be solved, but @qwwdfsad i think its not his fault and maybe it is related really to Android Build Tollchain. I have opened a bug for this in 26 March and they have reviewed it :

https://issuetracker.google.com/issues/129323351

I am using latest Android Studio 3.5 Canary 9. @SUPERCILEX what Android Studio version do you use ? I mean this is happening in every version since latest coroutine release or only to 3.5 canary 9 version ?

@SUPERCILEX
Copy link
Contributor Author

Dope. And I've tried going back to alpha 6 I think. Still broken so it was definitely introduced by coroutines. Still seems like a tooling bug though. 🤷‍♂️

@eakteam
Copy link

eakteam commented Mar 31, 2019

@SUPERCILEX , i understand , thanks for saving time not leaving me to downgrade too :D :D ... It will be fixed don't worry, it is just a very minor issue. I downgrade to 1.1.1 of coroutines but needed to fix this just for curiosity to test how the new version works ....

And some bug are normal, it is just Alpha version.
Best Regards, if they reply me to the bug report on Google i will reply back here to you to let you know, or just star that issue to stay updated

@eakteam
Copy link

eakteam commented Mar 31, 2019

@SUPERCILEX , thanks for providing Google with open source project, it is really important and they will solve this for sure in this way. I can't share mine because is Close Source, so thank you for supporting !
Best Regards

@eakteam
Copy link

eakteam commented Apr 1, 2019

@SUPERCILEX , i have solved id by adding this in my app gradle file

configurations {
        compile.exclude group: 'org.jetbrains.kotlinx', module: 'atomicfu-common'
    }

@LouisCAD
Copy link
Contributor

LouisCAD commented Apr 1, 2019

Same problem with version 1.2.0-alpha on my side.
Here's the error:

> Task :sample:mergeDebugJavaResource FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':sample:mergeDebugJavaResource'.
> 1 exception was raised by workers:
  com.android.builder.merge.DuplicateRelativeFileException: More than one file was found with OS independent path 'META-INF/atomicfu.kotlin_module'

And here's a permalink to a reproducing project: https://github.com/LouisCAD/Splitties/tree/e2389213a82aa91ca4ecf4a05fc67438e7c5ffd0
You can try it by just running ./gradlew :sample:assembleDebug.

Also, as @kherlopian2 said, adding this in the android { ... } block in build.gradle.kts can workaround that issue:

android {
    ...
    packagingOptions {
        pickFirst("META-INF/atomicfu.kotlin_module")
    }
    ...
}

@SUPERCILEX
Copy link
Contributor Author

@eakteam doesn't that break things at runtime though?

@eakteam
Copy link

eakteam commented Apr 1, 2019

@SUPERCILEX , No, for me everything is running OK. There are 2 modules in group org.jetbrains.kotlinx

Remember to exclude only atomicfu-common module

LouisCAD added a commit to LouisCAD/Splitties that referenced this issue Apr 2, 2019
@qwwdfsad
Copy link
Collaborator

qwwdfsad commented Apr 3, 2019

Thanks for the reproducer and possible workarounds!
kotlin_module file is generated and used by the compiler, so we have no control over it.

This issue will be solved in 1.3.40 on the compiler side: https://youtrack.jetbrains.com/issue/KT-30344
And in AS independently: https://issuetracker.google.com/issues/125696148

I will leave the issue open for a while to make it easier for users to find a workaround.

@JakeWharton
Copy link
Contributor

If you're using Gradle you can specify archivesBaseName to generate modules with different names (and thus different .kotlin_module file names) to avoid collisions.

@eakteam
Copy link

eakteam commented Apr 4, 2019

I don't understand why this is not solved yet in alpha-2 but we should use still the workaround ?

@JakeWharton
Copy link
Contributor

JakeWharton commented Apr 4, 2019 via email

@eakteam
Copy link

eakteam commented Apr 4, 2019

Hmmmm, but this can contains in the aar the workaround to simplify things for new users, than after it is finally solved can edit back ... Anyway just my thoughts.

@pranavbhart
Copy link

android {
    ...
    packagingOptions {
        pickFirst("META-INF/atomicfu.kotlin_module")
    }
    ...
}

Can confirm this worked for me^.

@eakteam
Copy link

eakteam commented Apr 12, 2019

This issue is still happening with latest Kotlin 1.3.30 and latest Coroutines 1.2.0.
I don't know if should be fixed by next Android Studio version or by Kotlin or Coroutines library
We still need to implement the workarounds to skip the failure about duplicate entry

tateisu added a commit to tateisu/SubwayTooter that referenced this issue Apr 12, 2019
@qwwdfsad
Copy link
Collaborator

qwwdfsad commented Apr 13, 2019

This issue is still happening with latest Kotlin 1.3.30 and latest Coroutines 1.2.0.

It was told before that it is not the library issue and that on Kotlin side it will be fixed in 1.3.40 and in AS 3.5 Canary 12.

@eakteam
Copy link

eakteam commented Apr 13, 2019

@qwwdfsad , sorry i have missed that comment 😊.
Thanks for confirming it !

1951FDG added a commit to 1951FDG/openpyn-nordvpn-juiceSSH that referenced this issue Apr 14, 2019
elizarov added a commit that referenced this issue Apr 20, 2019
* Update to atomicfu 0.12.4, which fixes plugin operation with
  kotlin-multiplatform
* Remove explicit dependencies (plugins adds them automatically)

Fixes #1116
Fixes #1064
@elizarov
Copy link
Contributor

It looks that is a side-effect of leaked atomicfu dependency. atomicfu.kotlin_module will disappear in version 1.2.1. See #1120

@elizarov elizarov added this to the 1.2.1 milestone Apr 20, 2019
elizarov added a commit that referenced this issue Apr 21, 2019
* Update to atomicfu 0.12.4, which fixes plugin operation with
  kotlin-multiplatform
* Remove explicit dependencies (plugins adds them automatically)

Fixes #1116
Fixes #1064
elizarov added a commit that referenced this issue Apr 22, 2019
This should really fix processing of class files

Fixes #1116
Fixes #1064
elizarov added a commit that referenced this issue Apr 23, 2019
This should really fix processing of class files

Fixes #1116
Fixes #1064
@elizarov elizarov added bug and removed question labels Apr 24, 2019
@rwsbillyang
Copy link

packagingOptions {
pickFirst 'META-INF/kotlinx-io.kotlin_module'
pickFirst 'META-INF/atomicfu.kotlin_module'
pickFirst 'META-INF/kotlinx-coroutines-io.kotlin_module'
}

packagingOptions {
        pickFirst 'META-INF/kotlinx-io.kotlin_module'
        pickFirst 'META-INF/atomicfu.kotlin_module'
        pickFirst 'META-INF/kotlinx-coroutines-io.kotlin_module'
    }

that worked with me.

that worked with me (kotlin 1.3.30 + coroutines1.2.0) too, thanks.

@Sunbreak
Copy link

Sunbreak commented Apr 29, 2019

@elizarov @qwwdfsad After upgrading to kotlin-v1.3.31 & coroutine-1.2.1, the leak of "atomicfu.kotlin_module" is fixed, but the leak of "kotlinx-coroutines-core.kotlin_module" is still there

Reproduce

git clone https://github.com/Sunbreak/notepad-sdk-mpp
cd androidSample && ./gradlew assembleDebug

@manishpatelgt
Copy link

By adding below line resolve issue

exclude 'META-INF/atomicfu.kotlin_module'

@namanh007
Copy link

packagingOptions {
        pickFirst 'META-INF/kotlinx-io.kotlin_module'
        pickFirst 'META-INF/atomicfu.kotlin_module'
        pickFirst 'META-INF/kotlinx-coroutines-io.kotlin_module'
    }

that worked with me.

that worked for me

@dhirajhimani
Copy link

You could try
packagingOptions { exclude 'META-INF/atomicfu.kotlin_module' }

@LouisCAD
Copy link
Contributor

I still have to put pickFirst("META-INF/kotlinx-coroutines-core.kotlin_module") in the packagingOptions to be able to run Android instrumented tests from a multiplatform project as of Kotlin 1.3.50 and kotlinx.coroutines 1.3.1.

@qwwdfsad
Copy link
Collaborator

Do you have the same error com.android.builder.merge.DuplicateRelativeFileException: More than one file was found with OS independent path ... otherwise?

@mirokolodii
Copy link

Still an issue for me in multiplatform project during project build, caused by this line:

 commonMain.dependencies {
            implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:1.3.2"

Message is More than one file was found with OS independent path 'META-INF/kotlinx-coroutines-core.kotlin_module'

AS ver. 3.5.2
Kotlin ver 1.3.50
Coroutines ver. 1.3.2

Workaround with packagingOptions doesn't work, probably packagingOptions are related to Android part, while this is a common one.

@linean
Copy link

linean commented Dec 3, 2019

@mirokolodii Did you manage to solve it?

@mirokolodii
Copy link

@linean Yes, issue was indeed fixed by packagingOptions, but it was required to put it into my app module instead multiplatform one, even though there are no dependencies to coroutines in app module.
Please note that I've also added pickFirst 'META-INF/ktor-*', as I had similar issue with Ktor library.

android {
packagingOptions {
        pickFirst 'META-INF/kotlinx-io.kotlin_module'
        pickFirst 'META-INF/atomicfu.kotlin_module'
        pickFirst 'META-INF/kotlinx-coroutines-io.kotlin_module'
        pickFirst 'META-INF/kotlinx-coroutines-core.kotlin_module'
        pickFirst 'META-INF/kotlinx-serialization-runtime.kotlin_module'
        pickFirst 'META-INF/ktor-*'
    }
}

@wangyongf
Copy link

@linean Yes, issue was indeed fixed by packagingOptions, but it was required to put it into my app module instead multiplatform one, even though there are no dependencies to coroutines in app module.
Please note that I've also added pickFirst 'META-INF/ktor-*', as I had similar issue with Ktor library.

android {
packagingOptions {
        pickFirst 'META-INF/kotlinx-io.kotlin_module'
        pickFirst 'META-INF/atomicfu.kotlin_module'
        pickFirst 'META-INF/kotlinx-coroutines-io.kotlin_module'
        pickFirst 'META-INF/kotlinx-coroutines-core.kotlin_module'
        pickFirst 'META-INF/kotlinx-serialization-runtime.kotlin_module'
        pickFirst 'META-INF/ktor-*'
    }
}

hello @mirokolodii , I have the same problem in my kotlin multiplatform project, so, we can only solve the problem by adding endless pickFirst statement in packagingOptions block? Any better way?

@LouisCAD
Copy link
Contributor

Do you have the same error com.android.builder.merge.DuplicateRelativeFileException: More than one file was found with OS independent path ... otherwise?

@qwwdfsad No, I don't.

@mirokolodii
Copy link

@linean Yes, issue was indeed fixed by packagingOptions, but it was required to put it into my app module instead multiplatform one, even though there are no dependencies to coroutines in app module.
Please note that I've also added pickFirst 'META-INF/ktor-*', as I had similar issue with Ktor library.

android {
packagingOptions {
        pickFirst 'META-INF/kotlinx-io.kotlin_module'
        pickFirst 'META-INF/atomicfu.kotlin_module'
        pickFirst 'META-INF/kotlinx-coroutines-io.kotlin_module'
        pickFirst 'META-INF/kotlinx-coroutines-core.kotlin_module'
        pickFirst 'META-INF/kotlinx-serialization-runtime.kotlin_module'
        pickFirst 'META-INF/ktor-*'
    }
}

hello @mirokolodii , I have the same problem in my kotlin multiplatform project, so, we can only solve the problem by adding endless pickFirst statement in packagingOptions block? Any better way?

No idea to be honest. I expect they will fix it eventually, but for now I've just added those things and forgot about them.

@elizarov
Copy link
Contributor

See the recent problem with ktor dependency: #1797 It will get fixed in the next release (already in develop)

@AliAzaz
Copy link

AliAzaz commented Oct 16, 2020

I'm getting this error while generating signed debug apk:

Entry name 'META-INF/lifecycle-livedata-ktx_release.kotlin_module' collided 

Anyone have possible solution for it. @elizarov ?

@LouisCAD
Copy link
Contributor

@AliAzaz This is not related to kotlinx.coroutines, and the solution is already in the comments here (pickFirst or exclude).

This is a bug in AGP (the Android Gradle Plugin), that is fixed since its version 7.0.0-alpha01, so you can upgrade from version 4.x if you are ready to test the next AGP and Android Studio 2020.3.1 early.

@Kotlin Kotlin deleted a comment from ChinGyi2019 Jun 29, 2021
@Siddharth-sing
Copy link

Siddharth-sing commented Aug 19, 2021

I'm getting this error while generating signed debug apk:

Entry name 'META-INF/lifecycle-livedata-ktx_release.kotlin_module' collided 

Anyone have possible solution for it. @elizarov ?

This worked for my project for the same error.
Put this in build.gradle(app)

         android {
                     ...
                      packagingOptions {
                      pickFirst("META-INF/atomicfu.kotlin_module")
                }
                      ...
           }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests