Question

Environment Configuration

  • com.android.tools.build:gradle:0.4
  • gradle version 1.6
  • jdk 1.6 (OSX)
  • android build tools version 17
  • compile sdk version 17

The issue that I seem to be having is that I can’t seem to exclude lombok from being added to the apk. I tried to do it by creating a provided configuration like this:

configurations {
   provided
}

sourceSets {
   main { compileClasspath += configurations.provided }
}

and then adding the dependency like this:

dependencies {
     provided ‘org.projectlombok:lombok:0.11.8′
}

But I’m still getting this error:

Error: duplicate files during packaging of APK <myapp>.apk
Path in archive: LICENSE
Origin 1: /<home>/.gradle/caches/artifacts-24/filestore/org.projectlombok/lombok/0.11.8/jar/e43ce2be16d8990568a4182c0bf996ad3ff0ba42/lombok-0.11.8.jar
Origin 2: /<home>/.gradle/caches/artifacts-24/filestore/org.sonatype.sisu.inject/cglib/2.2.1-v20090111/jar/7ce5e983fd0e6c78346f4c9cbfa39d83049dda2/cglib-2.2.1-v20090111.jar
:packageRelease FAILED

I have tried using lombok-api.jar which then causes a different issue regarding some AccessLevel annotation while performing dex.

Which suggests that its including the lombok jar file into the apk. This shouldn't be happening, any suggestions?

Was it helpful?

Solution

You can't use sourceSets because we use custom ones. You'd have to do the following:

android.applicationVariants.each { variant ->
    variant.javaCompile.classpath += configurations.provided.
}

However, it should be possible to instead remove the dependency from our "package" config (which replaces the "runtime" one.) I'll look into it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top