So here I am with my family our of town on a weekend, and I thought I'd
give Log4j on Android a try.

The first thing I run into is:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task
':Application:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException:
com.android.builder.packaging.DuplicateFileException: Duplicate files
copied in APK META-INF/LICENSE
File1:
C:\Users\ggregory\.gradle\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-core\2.8.2\979fc0cf8460302e4ffbfe38c1b66a99450b0bb7\log4j-core-2.8.2.jar
File2:
C:\Users\ggregory\.gradle\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-api\2.8.2\e590eeb783348ce8ddef205b82127f9084d82bf3\log4j-api-2.8.2.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: 1.995 secs

which is solved by:

https://stackoverflow.com/questions/37586800/android-gradle-duplicate-files-copied-in-apk-meta-inf-license-txt

Which means I have to add this to my build:

packagingOptions {
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/LICENSE'
}

I wonder if we should generate these files pretending we are in an
uber jar, either:

- with the project name in the name like META-INF/log4j2.LICENSE

- with maven AID in the name like META-INF/log4j-api.LICENSE

- with maven coords in the name like
META-INF/org.apache.logging.log4j-log4j-api.LICENSE

As an aside files like LICENSE and NOTICE do not have .txt extensions
which is lame IMO.

Ignore and do nothing? Thoughts?

Gary

Reply via email to