17

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.

Goo
  • 1,318
  • 1
  • 13
  • 31
Milos Cuculovic
  • 19,631
  • 51
  • 159
  • 265
  • Have you tried cleaning your project? Or else you can delete files from bin folder and build again. See if the problem exists. – harshit Sep 10 '12 at 07:16

3 Answers3

18

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.

William
  • 20,150
  • 8
  • 49
  • 91
Andre
  • 181
  • 1
  • 2
5

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!

Aditya Nikhade
  • 1,373
  • 10
  • 15
3

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.

Milos Cuculovic
  • 19,631
  • 51
  • 159
  • 265