Hi Xavier,
Is there any progress on an updated Gradle plugin to resolve this issue in
0.7.x?
For reference, I can reproduce this with the following config:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.7.1'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
dependencies {
compile 'com.google.android.gms:play-services:3.2.25'
compile 'com.android.support:support-v4:18.0.0'
compile 'commons-io:commons-io:2.4'
compile 'commons-lang:commons-lang:2.6'
}
I am using the recommended Gradle wrapper config from Android Studio
(Gradle v1.9). The error message is very similar to Patrick's:
:packageRelease
Error: duplicate files during packaging of APK
/Users/pc/android-projects/example/build/apk/example-release-unaligned.apk
Path in archive: META-INF/LICENSE.txt
Origin 1:
/Users/pc/.gradle/caches/modules-2/files-2.1/commons-lang/commons-lang/2.6/ce1edb914c94ebc388f086c6827e8bdeec71ac2/commons-lang-2.6.jar
Origin 2:
/Users/pc/.gradle/caches/modules-2/files-2.1/commons-io/commons-io/2.4/b1b6ea3b7e4aa4f492509a4952029cd8e48019ad/commons-io-2.4.jar
You can ignore those files in your build.gradle:
android {
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
}
:packageRelease FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':packageRelease'.
> Duplicate files copied in APK META-INF/LICENSE.txt
File 1:
/Users/pc/.gradle/caches/modules-2/files-2.1/commons-lang/commons-lang/2.6/ce1edb914c94ebc388f086c6827e8bdeec71ac2/commons-lang-2.6.jar
File 2:
/Users/pc/.gradle/caches/modules-2/files-2.1/commons-lang/commons-lang/2.6/ce1edb914c94ebc388f086c6827e8bdeec71ac2/commons-lang-2.6.jar
Adding the packaging exclusion as suggested by the error message does work
as a workaround.
Please do get in touch if you'd like more info or would like me to verify
any potential fixes.
All the best,
Pete
On Tuesday, 24 December 2013 20:50:17 UTC, Xavier Ducrohet wrote:
>
> Sorry, I ended up spending more time than I planned fixing some issues. My
> current plan is Thursday.
>
>
> On Tue, Dec 24, 2013 at 6:16 AM, Scott Battaglia
> <[email protected]<javascript:>
> > wrote:
>
>> Xavier,
>>
>> Were you able to push it? I didn't see it available when I checked in
>> search.maven.org
>>
>> Thanks
>> Scott
>>
>>
>> On Mon, Dec 23, 2013 at 2:42 AM, Xavier Ducrohet
>> <[email protected]<javascript:>
>> > wrote:
>>
>>> Not yet. I'm going to try to push it tomorrow.
>>>
>>>
>>> On Sun, Dec 22, 2013 at 3:07 PM, Noot <[email protected]
>>> <javascript:>>wrote:
>>>
>>>> Hi Xavier,
>>>>
>>>> Did you push 0.7.2? I still cannot solve this issue.
>>>>
>>>>
>>>> On Friday, December 20, 2013 12:14:35 PM UTC+11, Xavier Ducrohet wrote:
>>>>
>>>>> ah that's because it's only for applications, not libraries, because
>>>>> libraries don't package their dependencies.
>>>>>
>>>>> However test apps for libraries do... sigh. In my hurry to push a fix,
>>>>> I forgot about that. I'll push a 0.7.2 tomorrow.
>>>>>
>>>>>
>>>>> On Thu, Dec 19, 2013 at 5:07 PM, Traun Leyden <[email protected]>wrote:
>>>>>
>>>>>>
>>>>>> I am getting this error with Android Studio 0.4:
>>>>>>
>>>>>> Error: duplicate files during packaging of APK
>>>>>> /Users/traun/Development/couchbase-lite-android/
>>>>>> CouchbaseLiteProject/CBLite/build/apk/CBLite-debug-test-unaligned.apk
>>>>>> Path in archive: META-INF/ASL2.0
>>>>>> Origin 1: /Users/traun/.gradle/caches/modules-2/files-2.1/org.
>>>>>> codehaus.jackson/jackson-mapper-asl/1.9.2/
>>>>>> 95400a7922ce75383866eb72f6ef4a7897923945/jackson-mapper-asl-1.9.2.jar
>>>>>> Origin 2: /Users/traun/.gradle/caches/modules-2/files-2.1/org.
>>>>>> codehaus.jackson/jackson-core-asl/1.9.2/
>>>>>> 8493982bba1727106d767034bd0d8e77bc1931a9/jackson-core-asl-1.9.2.jar
>>>>>> You can ignore those files in your build.gradle:
>>>>>> android {
>>>>>> packagingOptions {
>>>>>> exclude 'META-INF/ASL2.0'
>>>>>> }
>>>>>> }
>>>>>> :CBLite:packageDebugTest FAILED
>>>>>>
>>>>>>
>>>>>> and I tried adding the packagingOptions directive (here is my entire
>>>>>> build.gradle file: https://gist.github.com/tleyden/8048897)
>>>>>>
>>>>>> but now it's giving me this error:
>>>>>>
>>>>>> * Where:
>>>>>> Build file '/Users/traun/Development/couchbase-lite-android/
>>>>>> CouchbaseLiteProject/CBLite/build.gradle' line: 38
>>>>>>
>>>>>> * What went wrong:
>>>>>> A problem occurred evaluating project ':CBLite'.
>>>>>> > Could not find method packagingOptions() for arguments [build_
>>>>>> 7e8h4gb29m24saphgjk26o3v1r$_run_closure3_closure10@6c80d028] on
>>>>>> project ':CBLite'.
>>>>>>
>>>>>> * Try:
>>>>>> Run with --stacktrace option to get the stack trace. Run with --info
>>>>>> or --debug option to get more log output.
>>>>>>
>>>>>> BUILD FAILED
>>>>>>
>>>>>>
>>>>>> Any ideas?
>>>>>>
>>>>>> On Thursday, December 19, 2013 3:24:52 PM UTC-8, Xavier Ducrohet
>>>>>> wrote:
>>>>>>
>>>>>>> Glad to hear!
>>>>>>>
>>>>>>>
>>>>>>> On Thu, Dec 19, 2013 at 3:23 PM, Nicolas Milliard
>>>>>>> <[email protected]>wrote:
>>>>>>>
>>>>>>>> I update 0.7.1 and it failed at first with :
>>>>>>>> -------------------------------------------------------------------
>>>>>>>> Error: duplicate files during packaging of APK
>>>>>>>> app/build/apk/app-debug-unaligned.apk
>>>>>>>> Path in archive: META-INF/services/javax.annotation.processing.
>>>>>>>> Processor
>>>>>>>> Origin 1: /home/niqo/.gradle/caches/modules-2/files-2.1/com.
>>>>>>>> squareup.dagger/dagger-compiler/1.1.0/d
>>>>>>>> db38c2be31deeb7a001177f7c358665e350d646/dagger-compiler-1.1.0.jar
>>>>>>>> Origin 2: /home/niqo/.gradle/caches/modules-2/files-2.1/com.
>>>>>>>> jakewharton/butterknife/4.0.1/f43b36925363701633d01adb8e54df
>>>>>>>> 7150397a78/butterknife-4.0.1.jar
>>>>>>>> You can ignore those files in your build.gradle:
>>>>>>>> android {
>>>>>>>> packagingOptions {
>>>>>>>> exclude 'META-INF/services/javax.annotation.processing.
>>>>>>>> Processor'
>>>>>>>> }
>>>>>>>> }
>>>>>>>> -------------------------------------------
>>>>>>>>
>>>>>>>> Adding the recommanded build config worked!
>>>>>>>>
>>>>>>>> Thanks for this fast fix.
>>>>>>>>
>>>>>>>> niColas
>>>>>>>>
>>>>>>>> On Thursday, December 19, 2013 2:52:03 PM UTC-8, Xavier Ducrohet
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> That's all you need. MavenCentral may still be replicating, I'm
>>>>>>>>> not sure.
>>>>>>>>>
>>>>>>>>> I don't see the artifacts on search.maven.org but I was able to
>>>>>>>>> build the samples (even after cleaning all of my local caches).
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Thu, Dec 19, 2013 at 2:40 PM, David Shen <[email protected]>wrote:
>>>>>>>>>
>>>>>>>>>> Hey quick question; if I want to use 0.7.1, I just need to change
>>>>>>>>>> dependencies {
>>>>>>>>>> classpath 'com.android.tools.build:gradle:*0.7.0' ->
>>>>>>>>>> 0.7.1*
>>>>>>>>>> }
>>>>>>>>>>
>>>>>>>>>> Or is there another step? I'm getting an 'artifact not found'
>>>>>>>>>> error. Thanks!
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Thursday, December 19, 2013 4:57:43 PM UTC-5, Xavier Ducrohet
>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>>> oh that's going to be more difficult to deal with, maybe.
>>>>>>>>>>>
>>>>>>>>>>> I just pused 0.7.1 to central to allow ignore duplicate files,
>>>>>>>>>>> which will not package either of them (which is fine for the
>>>>>>>>>>> typical
>>>>>>>>>>> LICENSE.txt file).
>>>>>>>>>>>
>>>>>>>>>>> However in this case you have two implementations. If they are
>>>>>>>>>>> needed at runtime, then you may not be able to use both libraries.
>>>>>>>>>>> If they are not needed then you'll be able to ignore
>>>>>>>>>>> META-INF/services/javax.annotation.processing.Processor and
>>>>>>>>>>> you'll be good.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Thu, Dec 19, 2013 at 11:44 AM, Nicolas Milliard <
>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> I have the same issue using Dagger and ButteKnife libraries
>>>>>>>>>>>> that both use annotation processor:
>>>>>>>>>>>> [DEBUG] [org.gradle.api.Project] => META-INF/services/javax.
>>>>>>>>>>>> annotation.processing.Processor
>>>>>>>>>>>> [ERROR] [org.gradle.api.Task] Error: duplicate files during
>>>>>>>>>>>> packaging of APK /app/build/apk/app-debug-unaligned.apk
>>>>>>>>>>>> [ERROR] [org.gradle.api.Task] Path in archive:
>>>>>>>>>>>> META-INF/services/javax.annotation.processing.Processor
>>>>>>>>>>>> [ERROR] [org.gradle.api.Task] Origin 1:
>>>>>>>>>>>> .gradle/caches/modules-2/files-2.1/com.squareup.dagger/dagge
>>>>>>>>>>>> r-compiler/1.1.0/ddb38c2be31deeb7a001177f7c358665e350d646/da
>>>>>>>>>>>> gger-compiler-1.1.0.jar
>>>>>>>>>>>> [ERROR] [org.gradle.api.Task] Origin 2:
>>>>>>>>>>>> .gradle/caches/modules-2/files-2.1/com.jakewharton/butterkni
>>>>>>>>>>>> fe/4.0.1/f43b36925363701633d01adb8e54df7150397a78/butterknif
>>>>>>>>>>>> e-4.0.1.jar
>>>>>>>>>>>>
>>>>>>>>>>>> Not sure how to workaround this.
>>>>>>>>>>>>
>>>>>>>>>>>> Nicolas
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On Thursday, December 19, 2013 5:15:25 AM UTC-8, Patrick Boos
>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>> Current workaround from https://code.google.com/p
>>>>>>>>>>>>> /android/issues/detail?id=61573#c19 :
>>>>>>>>>>>>>
>>>>>>>>>>>>> find ~/.gradle/caches/ -iname "*.jar" -exec zip -d '{}'
>>>>>>>>>>>>> 'META-INF/NOTICE*' \;
>>>>>>>>>>>>> find ~/.gradle/caches/ -iname "*.jar" -exec zip -d '{}'
>>>>>>>>>>>>> 'META-INF/LICENSE*' \;
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Thursday, December 19, 2013 2:00:14 PM UTC+1, Patrick Boos
>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Seems there is already a fix on the way for this:
>>>>>>>>>>>>>> https://code.google.com/p/android/issues/detail?id=61573#c14
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On Thursday, December 19, 2013 1:55:35 PM UTC+1, Patrick Boos
>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Using commons-io-1.3.2.jar and commons-lang3-3.1.jar
>>>>>>>>>>>>>>> together seems to break the build with the error message below.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> :app:packageRelease
>>>>>>>>>>>>>>>> Error: duplicate files during packaging of APK
>>>>>>>>>>>>>>>> /Users/whatever/Development/whatever/app/build/apk/app-
>>>>>>>>>>>>>>>> release-unaligned.apk
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Path in archive: META-INF/LICENSE.txt
>>>>>>>>>>>>>>>> Origin 1: /Users/whatever/.gradle/caches
>>>>>>>>>>>>>>>> /modules-2/files-2.1/commons-io/commons-io/1.3.2/b6dde38349
>>>>>>>>>>>>>>>> ba9bb5e6ea6320531eae969985dae5/commons-io-1.3.2.jar
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Origin 2: /Users/whatever/.gradle/caches
>>>>>>>>>>>>>>>> /modules-2/files-2.1/org.apache.commons/commons-lang3/3.1/
>>>>>>>>>>>>>>>> 905075e6c80f206bbe6cf1e809d2caa69f420c76/commons-lang3-3.1.
>>>>>>>>>>>>>>>> jar
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> :app:packageRelease FAILED
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> FAILURE: Build failed with an exception.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> * What went wrong:
>>>>>>>>>>>>>>>> Execution failed for task ':app:packageRelease'.
>>>>>>>>>>>>>>>> > Duplicate files copied in APK META-INF/LICENSE.txt
>>>>>>>>>>>>>>>> File 1: /Users/whatever/.gradle/caches
>>>>>>>>>>>>>>>> /modules-2/files-2.1/commons-io/commons-io/1.3.2/b6dde38349
>>>>>>>>>>>>>>>> ba9bb5e6ea6320531eae969985dae5/commons-io-1.3.2.jar
>>>>>>>>>>>>>>>> File 2: /Users/whatever/.gradle/caches
>>>>>>>>>>>>>>>> /modules-2/files-2.1/commons-io/commons-io/1.3.2/b6dde38349
>>>>>>>>>>>>>>>> ba9bb5e6ea6320531eae969985dae5/commons-io-1.3.2.jar
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Any idea of a quick workaround to fix this?
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Cheers,
>>>>>>>>>>>>>>> Patrick
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>> --
>>>>>>>>>>>> You received this message because you are subscribed to the
>>>>>>>>>>>> Google Groups "adt-dev" group.
>>>>>>>>>>>> To unsubscribe from this group and stop receiving emails from
>>>>>>>>>>>> it, send an email to [email protected].
>>>>>>>>>>>>
>>>>>>>>>>>> For more options, visit https://groups.google.com/grou
>>>>>>>>>>>> ps/opt_out.
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>> Xavier Ducrohet
>>>>>>>>>>> Android SDK Tech Lead
>>>>>>>>>>> Google Inc.
>>>>>>>>>>> http://developer.android.com | http://tools.android.com
>>>>>>>>>>>
>>>>>>>>>>> Please do not send me questions directly. Thanks!
>>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> You received this message because you are subscribed to the
>>>>>>>>>> Google Groups "adt-dev" group.
>>>>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>>>>> send an email to [email protected].
>>>>>>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Xavier Ducrohet
>>>>>>>>> Android SDK Tech Lead
>>>>>>>>> Google Inc.
>>>>>>>>> http://developer.android.com | http://tools.android.com
>>>>>>>>>
>>>>>>>>> Please do not send me questions directly. Thanks!
>>>>>>>>>
>>>>>>>> --
>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>> Groups "adt-dev" group.
>>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>>> send an email to [email protected].
>>>>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Xavier Ducrohet
>>>>>>> Android SDK Tech Lead
>>>>>>> Google Inc.
>>>>>>> http://developer.android.com | http://tools.android.com
>>>>>>>
>>>>>>> Please do not send me questions directly. Thanks!
>>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "adt-dev" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to [email protected].
>>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Xavier Ducrohet
>>>>> Android SDK Tech Lead
>>>>> Google Inc.
>>>>> http://developer.android.com | http://tools.android.com
>>>>>
>>>>> Please do not send me questions directly. Thanks!
>>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "adt-dev" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected] <javascript:>.
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>
>>>
>>>
>>> --
>>> Xavier Ducrohet
>>> Android SDK Tech Lead
>>> Google Inc.
>>> http://developer.android.com | http://tools.android.com
>>>
>>> Please do not send me questions directly. Thanks!
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "adt-dev" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected] <javascript:>.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "adt-dev" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> --
> Xavier Ducrohet
> Android SDK Tech Lead
> Google Inc.
> http://developer.android.com | http://tools.android.com
>
> Please do not send me questions directly. Thanks!
>
--
You received this message because you are subscribed to the Google Groups
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.