[Android Software Development] FrankWins:
Hello All,

I am attempting to replace an app's jackson library (com.fasterxml.jackson.core) with a newer version. I started off by putting the app I want to modify APK into the "patched-app" source folder from the examples. In the patched build.gradle, I used

compile 'com.fasterxml.jackson.core:jackson-databind:2.7.3'

and I made a new file under patched/java/com/fasterxml/jackson/core/package-info.java

In that file, I have the following:

[MENTION=6284421]Dexr[/MENTION]emove(target = "com.fasterxml.jackson.core", recursive = true)
package remove_com_fasterxml_jackson_core;

import lanchon.dexpatcher.annotation.*;

Now when I go to "Build>Make Project" I get the following

:patched:transformResourcesWithMergeJavaResForDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':patched:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE
File1: /home/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-core/2.7.3/1499b854ae9f370409792db5af1b552dc7d9682f/jackson-core-2.7.3.jar
File2: /home/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-annotations/2.7.0/19f42c154ffc689f40a77613bc32caeb17d744e3/jackson-annotations-2.7.0.jar
File3: /home/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-databind/2.7.3/f12e6cd05cbaecd74d16e685d45b627732939e42/jackson-databind-2.7.3.jar

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 2.588 secs

Can you tell me what I am doing wrong? I have tried to follow the instructions and example I found in the dexpatcher-tool project.

// If you are dropping in an off-the-shelf replacement library and it

// already includes its own package annotations, you can do this:

//

// [MENTION=6284421]Dexr[/MENTION]emove(target = "com.acme.util", recursive = true)

// package remove_com_acme_util;​

And I also saw this:

// We import an Android library, a file chooser, just for fun. This pulls in all its

// resources that will be transparently merged, like other resources from this project,

// with those of the source app. Each component will have its own independent 'R' class.

// The numeric IDs of the resources coming from the source app will be kept constant.

compile('ru.bartwell:exfilepicker:1.8') {

// But the imported library has a transitive dependency on a module that is already

// present in the source app. So we exclude it from the import, keeping the source

// app's version. Alternatively we could delete the copy brought in by the source

// app using DexPatcher package annotations.

exclude module: 'support-v4'

}
​

Which seems to allude to "DexPatcher package annotations" -- does this mean the [MENTION=6284421]Dexr[/MENTION]emove annotation that I'm already using, or something else?

---------- Post added at 04:55 PM ---------- Previous post was at 04:08 PM ----------

For the record, I was able to find a post earlier in this thread which made me think to look and see if it was a problem with the gradle plugin itself. I was able to insert this into the patched build.gradle:

packagingOptions {

exclude 'META-INF/LICENSE'

}

which was able to solve the duplicate file issue.​