A quick follow up to note that with 2.8.2, using log4j-api does not cause problems but then adding log4j-core causes the app to fail to start. So I definitively see an Android epic for 2.10. Maybe this is when we want to split up log4j-core.
Gary On Sat, Jul 8, 2017 at 3:20 PM, Gary Gregory <garydgreg...@gmail.com> wrote: > 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:transformResourcesWithMergeJav > aResForDebug'. > > 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\979fc0cf8460302e4ffbfe38c1b66a > 99450b0bb7\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\e590eeb783348ce8ddef205b82127f > 9084d82bf3\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 > >