Duplicate files at the same path inside the APK, when adding jar

Showing 1-15 of 15 messages
Duplicate files at the same path inside the APK, when adding jar poeschel 3/29/11 9:33 AM
Hello!

I try to build the i-jetty webserver using maven-android-plugin.
I created a set of pom.xml files for this and I got the above error
building it. I first thought, that the error is because of some apklibs
contain the same references. So I copied all the sourcecode together in
one src dir and modified the relevant pom.xml but still get the same error.
I don't know which files are duplicate. I tried with 2.9.0-beta-1,
2.9.0-beta-2 and even built an 2.9.0-SNAPSHOT but nothing works. What
can I do to find my mistake ? Can I do something to help debugging ?

Thanks,
Lars


Re: [maven-android-developers] Duplicate files at the same path inside the APK, when adding jar Manfred Moser (simpligility) 3/29/11 9:10 AM
Wanna share the pom files in github or somewhere so we can have a look?

> --
> You received this message because you are subscribed to the Google Groups
> "Maven Android Developers" group.
> To post to this group, send email to
> maven-androi...@googlegroups.com.
> To unsubscribe from this group, send email to
> maven-android-developers+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/maven-android-developers?hl=en.
>
>

Re: Duplicate files at the same path inside the APK, when adding jar poeschel 3/29/11 11:52 AM

On 29 Mrz., 18:10, "Manfred Moser" <manf...@mosabuam.com> wrote:
> Wanna share the pom files in github or somewhere so we can have a look?

I already attached the pom.xml to the first post for the case that
i-jetty-server and i-jetty-ui sources are mixed to one single directory.

Here now comes the case for the original i-jetty directory structure.
This archive contains the needed poms and resources for i-jetty-server.
Simply extract in current i-jetty-SNAPSHOT.

Lars

Re: [maven-android-developers] Re: Duplicate files at the same path inside the APK, when adding jar poeschel 3/30/11 5:45 AM
Am 29.03.2011 20:52, schrieb Lars Poeschel:

I digged a bit deeper and found one problem:
All of the org.eclipse.jetty.jetty-*.jar s included from i-jetty contain
a file about.html containing the license. It seems that android's
ApkBuilder.java can not handle this. It thinks that files are duplicate.
Has someone an idea how to handle that issue best ?

Thanks, Lars

Re: [maven-android-developers] Re: Duplicate files at the same path inside the APK, when adding jar Manfred Moser (simpligility) 3/30/11 9:37 AM
--
Manfred Moser
http://www.mosabuam.com
skype mosabua, twitter.com/mosabua
http://www.linkedin.com/in/manfredmoser

Not sure.. worst case you can patch the plugin code and add a new
option that allows to exclude files of certain name patterns from the
exploded dependencies..

Not even sure if that is not already there .. check out the plugin
options.

manfred

Re: [maven-android-developers] Re: Duplicate files at the same path inside the APK, when adding jar joakime 3/30/11 1:56 PM
I"m on the hook to migrate the i-jetty build when I get time. (but not likely until mid/end of April.

Busy,
- Joakim

--
You received this message because you are subscribed to the Google Groups "Maven Android Developers" group.
To post to this group, send email to maven-androi...@googlegroups.com.
To unsubscribe from this group, send email to maven-android-developers+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/maven-android-developers?hl=en.


Re: [maven-android-developers] Re: Duplicate files at the same path inside the APK, when adding jar poeschel 3/31/11 3:32 AM
Am 30.03.2011 18:37, schrieb Manfred Moser:

> Not sure.. worst case you can patch the plugin code and add a new
> option that allows to exclude files of certain name patterns from the
> exploded dependencies.. Not even sure if that is not already there ..
> check out the plugin options.

I found no option that does that - at least not in the maven-android-plugin.
Doing this would be very difficult. I attached a stacktrace to
illustrate that.

[ERROR] Cannot add resources from jar
com.android.sdklib.build.DuplicateFileException: Duplicate files at the
same path inside the APK
        at
com.android.sdklib.build.ApkBuilder$JavaAndNativeResourceFilter.checkEntry(ApkBuilder.java:121)
        at
com.android.sdklib.internal.build.SignedJarBuilder.writeZip(SignedJarBuilder.java:225)
        at
com.android.sdklib.build.ApkBuilder.addResourcesFromJar(ApkBuilder.java:556)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at
com.jayway.maven.plugins.android.phase09package.ApkBuilder.addResourcesFromJar(ApkBuilder.java:266)
        at
com.jayway.maven.plugins.android.phase09package.ApkMojo.doAPKWithAPKBuilder(ApkMojo.java:307)
        at
com.jayway.maven.plugins.android.phase09package.ApkMojo.createApkFile(ApkMojo.java:196)
        at
com.jayway.maven.plugins.android.phase09package.ApkMojo.execute(ApkMojo.java:169)
        at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
        at
org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at
org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at
org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)


The last step that is controled by the maven-android-plugin is

com.jayway.maven.plugins.android.phase09package.ApkBuilder.addResourcesFromJar(ApkBuilder.java:266)

Here a whole jar file is handed over to google's SDK Tools, there the
depackaging takes place. The relevant class is:
com/android/sdklib/build/ApkBuilder.java. There some checks take place
(for duplicate files for example) and there are already some exceptions
from this (for example META-INF directory or .cvsignore files and so
on). Here would be the best place to handle this issue. But I think I
never get google to exclude "about.html" in their SDK.
The other, dirty way would be to de-jar every jar in
maven-andriod-plugin, look for about.html, exclude it and re-jar it and
then hand it over to google's ApkBuilder. Would a patch that does this
have a chance to get included ?
What do you think would be the best way ?
As a workaround I remove the about.html's from every relevant jar in my
local maven repository by hand at the moment.

Regards,
Lars

Re: [maven-android-developers] Re: Duplicate files at the same path inside the APK, when adding jar poeschel 3/31/11 6:18 AM
Am 31.03.2011 12:32, schrieb Lars Poeschel:

Heureka!

Finally I found it! There is indeed one option, which does what I need
in the maven-android-plugin.
<extractDuplicates>true</extractDuplicates>
does what I need.

Thank you!

Re: [maven-android-developers] Re: Duplicate files at the same path inside the APK, when adding jar Manfred Moser (simpligility) 3/31/11 9:03 AM
> Am 31.03.2011 12:32, schrieb Lars Poeschel:
>> Am 30.03.2011 18:37, schrieb Manfred Moser:
..
> Heureka!
>
> Finally I found it! There is indeed one option, which does what I need
> in the maven-android-plugin.
> <extractDuplicates>true</extractDuplicates>
> does what I need.
>
> Thank you!


Ha.. sweet. I thought I saw that problem and a solution for it before..

Re: [maven-android-developers] Re: Duplicate files at the same path inside the APK, when adding jar Eric Turley 1/10/13 2:53 PM
I'm getting this problem also, but the <extractDuplicates> change didn't fix it for me.
(Apologies for zombie-ing this thread, but it seems more appropriate than making what appears to be a duplicate.)

I've been searching and hacking away, trying different things with my pom config. None are working so far.

My goal is to do maven resource filtering on a properties file: <project-root>/assets/build/buildver.properties
I'd like to filter it in place, rather than copy it from, say, /assets/ to /filtered-assets/. (Leaving it in place makes the project more compatible with IDEs - they don't need to be adjusted, but can pull in assets from the default android structure.)

When I first ran into this problem, I tried to work around it by creating this directory/file structure:
-assets
-assets-unfiltered
---build
------buildnum.properties
Then I configured the resources plugin to filter buildnum.properties, but deposit it in the assets/build directory. Works great when building with maven. But when building via an IDE (like Idea), the buildnum.properties file never gets copied to asset/build. It's OK that it's not filtered - that's no big deal. But it won't exist, of course. So if we build and deploy the app to a device through Idea, that file will be missing

I'm using 3.5.0 of the android-maven-plugin.
I've tried a number of pom changes, among them:

1) Configure android-maven-plugin to extractDuplicates:
<configuration>
<extractDuplicates>true</extractDuplicates>
</configuration>
2) Set maven-resources-plugin to execute during initialize/copy-resources:
<phase>initialize</phase>
<goals>
<goal>copy-resources</goal>
</goals>
3) Try to get the resource filtering to filter the source location but deposit to the build location by specifying in the resources.resource element:
<directory>${project.basedir}/assets/build</directory>
<targetPath>${project.build.directory}/assets/build</targetPath>
4) Set the android-maven-plugin to execute in the generate-sources phase, generate-sources goal (which I think it does by default already?)
<phase>generate-sources</phase>
<goals>
<goal>generate-sources</goal>
</goals>

Finally, here is the stack from the build error:

[ERROR] Cannot add source folder
com.android.sdklib.build.DuplicateFileException: Duplicate files at the same path inside the APK
        at com.android.sdklib.build.ApkBuilder.doAddFile(ApkBuilder.java:814)
        at com.android.sdklib.build.ApkBuilder.addFile(ApkBuilder.java:505)
        at com.android.sdklib.build.ApkBuilder.processFileForResource(ApkBuilder.java:863)
        at com.android.sdklib.build.ApkBuilder.processFileForResource(ApkBuilder.java:849)
        at com.android.sdklib.build.ApkBuilder.processFileForResource(ApkBuilder.java:849)
        at com.android.sdklib.build.ApkBuilder.addSourceFolder(ApkBuilder.java:619)
        at com.android.sdklib.build.ApkBuilder.addSourceFolder(ApkBuilder.java:601)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.jayway.maven.plugins.android.phase09package.ApkBuilder.addSourceFolder(ApkBuilder.java:268)
        at com.jayway.maven.plugins.android.phase09package.ApkMojo.doAPKWithAPKBuilder(ApkMojo.java:590)
        at com.jayway.maven.plugins.android.phase09package.ApkMojo.createApkFile(ApkMojo.java:381)
        at com.jayway.maven.plugins.android.phase09package.ApkMojo.execute(ApkMojo.java:332)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Re: Duplicate files at the same path inside the APK, when adding jar Muhi Masoud 4/17/13 8:49 AM
Eric Turley did you ever get this working I have the same problem.
Thanks
Re: Duplicate files at the same path inside the APK, when adding jar Eric Turley 4/17/13 12:58 PM
No - I never got it working.
I abandoned this path for a completely different means which is no longer applicable to this thread.
:(
Re: Duplicate files at the same path inside the APK, when adding jar Matt Wolfe 4/23/13 12:18 PM
All the sudden I'm getting this problem as well.
I have a project like so
Project A depends on Project B, Project B depends on Project C.

B and C  both have NDK libs but A does not have any (but does use C's ndk libs).

This worked up until recently. Weird that it didn't stop working at the same time as I upgraded to 3.5.3. It took several days and a bunch of builds before the problem came up. I think eclipse must have cleared out something.

I noticed that I used to use <clearNativeArtifacts>true</clearNativeArtifacts>
but that caused my build to fail saying that the so was missing (at build time). Then I set that to false and now the build works up until the last step when we get the duplicate error.

Any suggestions?
Re: Duplicate files at the same path inside the APK, when adding jar Jianing Zhang 2/25/14 4:42 PM
Hey guys,

I ran into the same problem, tried with <extractDuplicates>true</extractDuplicates> , didn't work out. Did any of you guys figure out how to solve this issue? 

Any comments? Thanks!
Re: [maven-android-developers] Re: Duplicate files at the same path inside the APK, when adding jar hanguang 2/25/14 8:54 PM
you might add some resource files multiple times. double check maven-resource-plugin outputs to see if some resource files got copied more than once.


--
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-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.