Duplicated file: MANIFEST.MF

31 views
Skip to first unread message

Peter Siegmund

unread,
Aug 4, 2015, 12:51:40 AM8/4/15
to Maven Android Developers
I've got a problem with external dependencies. My project structure uses shared code for java projects and Android.

The shared code creates jar files and are linked (scope: compile) into my Android library (AAR). This works perfect. But then, I want to use the AAR dependency into my APK and I get an Duplicated file: MANIFEST.MF error, because the APK will include it.

<extractDuplicates>true</extractDuplicates> doesn't do anything for these manifest.mf file. How can I fix this?

This is the error from the shell:

[ERROR] Failed to execute goal com.simpligility.maven.plugins:android-maven-plugin:4.3.0:apk (default-apk) on project com.example: Duplicated file: MANIFEST.MF, found in archive ~/.m2/repository/com/example/shared/1.0.0-SNAPSHOT/com.example.shared-1.0.0-SNAPSHOT.jar and ~/.m2/repository/com/example/server/1.0.0-SNAPSHOT/com.example.server-1.0.0-SNAPSHOT.jar: Duplicate files at the same path inside the APK -> [Help 1]

Peter Siegmund

unread,
Aug 4, 2015, 12:51:40 AM8/4/15
to Maven Android Developers
I use shared code for Java and Android projects and can't build an APK, because of Duplicated file: MANIFEST.MF. The jar files are connected to my Android library with scope: compile.

The <extractDuplicates>true</extractDuplicates> doesn't do anything against this problem.

[ERROR] Failed to execute goal com.simpligility.maven.plugins:android-maven-plugin:4.3.0:apk (default-apk) on project com.example: Duplicated file: MANIFEST.MF, found in archive ~/.m2/repository/com/example/shared/1.0.0-SNAPSHOT/com.example.shared-1.0.0-SNAPSHOT.jar and ~/.m2/repository/com/example/server/1.0.0-SNAPSHOT/com.example.server-1.0.0-SNAPSHOT.jar: Duplicate files at the same path inside the APK -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:

Andrew Bowley

unread,
Aug 5, 2015, 1:56:55 AM8/5/15
to maven-androi...@googlegroups.com
Hi Peter

I found a bug with extractDuplicates which you can see at https://github.com/simpligility/android-maven-plugin/issues/660#

A possible workaround is to edit jar files in the repository to remove duplicates. This is ok for files like license.txt, but may be problematic for manifests.

Regards

Andrew
--
You received this message because you are subscribed to the Google Groups "Maven Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to maven-android-deve...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Csaba Kozák

unread,
Aug 31, 2015, 3:18:18 PM8/31/15
to Maven Android Developers
It seems that problem is now fixed. However i really advise against editing the dependency jar files downloaded to the
local repository. This means everytime somebody downloads such a dependency, he/she has to edit the jar file.
This will lead to problematic, unreproducable builds which will kick dependency management in the back.

You could use this workaround:

<excludeJarResources>
    <excludeJarResource>MANIFEST.MF,etc</excludeJarResource>
</excludeJarResources>

Reply all
Reply to author
Forward
0 new messages