Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Duplicate files at the same path inside the APK

I have an application using some librarries.

The problem is that when I am trying o export the apk file, I am getting the "Duplicate files at the same path inside the APK".

Here is the log:

org.eclipse.core.runtime.CoreException: Duplicate files at the same path inside the APK
at com.android.ide.eclipse.adt.internal.project.ExportHelper.exportReleaseApk(ExportHelper.java:284)
at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard.doExport(ExportWizard.java:295)
at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard.access$0(ExportWizard.java:232)
at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard$1.run(ExportWizard.java:217)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Caused by: com.android.sdklib.build.DuplicateFileException: Duplicate files at the same path inside the APK
at com.android.sdklib.build.ApkBuilder$JavaAndNativeResourceFilter.checkEntry(ApkBuilder.java:123)
at com.android.sdklib.internal.build.SignedJarBuilder.writeZip(SignedJarBuilder.java:225)
at com.android.sdklib.build.ApkBuilder.addResourcesFromJar(ApkBuilder.java:563)
at com.android.ide.eclipse.adt.internal.build.BuildHelper.finalPackage(BuildHelper.java:372)
at com.android.ide.eclipse.adt.internal.project.ExportHelper.exportReleaseApk(ExportHelper.java:255)
... 4 more

Anyone has to manage this problem?

Thank you very much.

EDIT: Solution

I figured out what the problem was. I included a JAR file that had an AndroidManifest.xml file in it, which was conflicting with my own project's AndroidManifest.xml file. The solution in my instance was to rebuild the JAR file, making sure it excluded its own version of AndroidManifest.xml, then to re-include the new version of the JAR file into my project. You might need to clean the project after doing this.

like image 391
Milos Cuculovic Avatar asked Sep 10 '12 07:09

Milos Cuculovic


3 Answers

If you happen to be having this issue while using Maven to do your build, I was able to fix it by putting in:

<extractDuplicates>true</extractDuplicates>

into the Maven Android plugin configuration tag.

like image 105
Andre Avatar answered Nov 13 '22 08:11

Andre


Check the external jars you have imported in your application..

Project Properties -> Java Build Path -> Libraries -> Add External JARs...

There might be some duplicate files imported!

like image 26
Aditya Nikhade Avatar answered Nov 13 '22 06:11

Aditya Nikhade


I figured out what the problem was. I included a JAR file that had an AndroidManifest.xml file in it, which was conflicting with my own project's AndroidManifest.xml file. The solution in my instance was to rebuild the JAR file, making sure it excluded its own version of AndroidManifest.xml, then to re-include the new version of the JAR file into my project. You might need to clean the project after doing this.

like image 3
Milos Cuculovic Avatar answered Nov 13 '22 06:11

Milos Cuculovic