0

When compiling and building my android app, an error as shown below keeps occurring. I have been using this stack overflow answer to solve the error and exclude the duplicate files.

Here is the error I get when I try to build my project.

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK com/google/appengine/repackaged/org/apache/commons/codec/language/bm/sep_approx_spanish.txt
    File1: /Users/tomfinet/.gradle/caches/modules-2/files-2.1/com.google.appengine/appengine-api-1.0-sdk/1.9.28/e92c18272b555027d9ec666e7a89162f10638314/appengine-api-1.0-sdk-1.9.28.jar
    File2: /Users/tomfinet/.gradle/caches/modules-2/files-2.1/com.google.appengine/appengine-endpoints/1.9.28/bf2e8a74bd28e388b3487fc78a0c7adfa592fd5d/appengine-endpoints-1.9.28.jar

When I run the terminal command ./gradlew dependencies as instructed in the stack overflow answer, I am supposed to see the entire dependency tree for my project.

However all I see is this:

Downloading https://services.gradle.org/distributions/gradle-2.10-all.zip
.............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Unzipping /Users/tomfinet/.gradle/wrapper/dists/gradle-2.10-all/a4w5fzrkeut1ox71xslb49gst/gradle-2.10-all.zip to /Users/tomfinet/.gradle/wrapper/dists/gradle-2.10-all/a4w5fzrkeut1ox71xslb49gst
Set executable permissions for: /Users/tomfinet/.gradle/wrapper/dists/gradle-2.10-all/a4w5fzrkeut1ox71xslb49gst/gradle-2.10/bin/gradle
google-services plugin could not detect any version for com.google.android.gms or com.google.firebase, default version: 9.0.0 will be used.
please apply google-services plugin at the bottom of the build file.
Incremental java compilation is an incubating feature.
:dependencies

------------------------------------------------------------
Root project
------------------------------------------------------------

No configurations

BUILD SUCCESSFUL

Total time: 53.171 secs

This build could be faster, please consider using the Gradle Daemon: https://docs.gradle.org/2.10/userguide/gradle_daemon.html

Here is my gradle file for the backend:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.google.appengine:gradle-appengine-plugin:1.9.28'
    }
}

repositories {
    jcenter();
}

apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'appengine'

sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7

dependencies {
  appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.28'
  compile 'com.google.appengine:appengine-endpoints:1.9.28'
  compile 'com.google.appengine:appengine-endpoints-deps:1.9.28'
  compile 'javax.servlet:servlet-api:2.5'
  compile 'com.googlecode.objectify:objectify:5.0.3'
}

appengine {
  downloadSdk = true
  appcfg {
    oauth2 = true
  }
  endpoints {
    getClientLibsOnBuild = true
    getDiscoveryDocsOnBuild = true
  }
}

So how do I resolve this conflict between the dependencies? I am pretty sure I have to exclude the conflicting files. But how do I find the files that are causing this?

Community
  • 1
  • 1
Tom Finet
  • 2,056
  • 6
  • 30
  • 54
  • both appengine-api-1.0-sdk-1.9.28.jar and appengine-endpoints-1.9.28.jar contain file with the same name - sep_approx_spanish.txt. You need to exclude it from merge – Vladyslav Matviienko Jun 30 '16 at 09:27
  • ok but when i do `compile 'com.google.appengine:appengine-endpoints:1.9.28'{ exclude "sep_approx_spanish.txt" }` Gradle does not build. – Tom Finet Jun 30 '16 at 09:33
  • ...does not build with error...? – Vladyslav Matviienko Jun 30 '16 at 09:38
  • I mean builds with error sorry – Tom Finet Jun 30 '16 at 09:40
  • How would I exclude it – Tom Finet Jun 30 '16 at 09:40
  • Yes, and **what is the error**? – Vladyslav Matviienko Jun 30 '16 at 09:43
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/116062/discussion-between-tom-finet-and-vlad-matvienko). – Tom Finet Jun 30 '16 at 09:45
  • @TomFinet I'm having this same issue. I've excluded the file from the final build with packagingOptions and it just throws an error for the another file in the package. There's upwards of 50 (http://grepcode.com/file/repo1.maven.org/maven2/org.apache.karaf.jaas/org.apache.karaf.jaas.modules/4.0.0/org/apache/commons/codec/language/bm/sep_approx_spanish.txt) and commenting them all throws another error. I don't believe excluding the file itself is the correct approach. – sublimental Aug 11 '16 at 21:26

0 Answers0