2

I'm going through the tutorials for endpoints. I am trying to get this project to run but my Android studio is presenting a strange problem when I try to run the project.

The error is:

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: C:\Users\alexa\.gradle\caches\modules-2\files-2.1\com.google.appengine\appengine-endpoints\1.9.28\bf2e8a74bd28e388b3487fc78a0c7adfa592fd5d\appengine-endpoints-1.9.28.jar
    File2: C:\Users\alexa\.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

This is my gradle for the backend that is throwing the error:

// If you would like more information on the gradle-appengine-plugin please refer to the github page
// https://github.com/GoogleCloudPlatform/gradle-appengine-plugin

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'
}

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

I have tried this stackoverflow's accepted answer but it did not work for me. Namely, I tried the following variations in my gradle:

compile 'com.google.appengine:appengine-endpoints:1.9.28'{
        exclude "sep_approx_spanish.txt"
    }
 compile 'com.google.appengine:appengine-endpoints-deps:1.9.28

compile 'com.google.appengine:appengine-endpoints:1.9.28'
compile 'com.google.appengine:appengine-endpoints-deps:1.9.28{
        exclude "sep_approx_spanish.txt"
    }

but when I sync it, I get this error:

Error:(27, 0) Gradle DSL method not found: 'com.google.appengine:appengine-endpoints-deps:1.9.28()'
Possible causes:<ul><li>The project 'BackendAPITest' may be using a version of Gradle that does not contain the method.

These photos show my attempts at it.

enter image description here

enter image description here

Does any one know a good fix to this? I followed the tutorial exactly but I keep getting this problem. All my SDK's are up to date along with my IDE. My java is on the latest version. Help?

Community
  • 1
  • 1
booky99
  • 1,436
  • 4
  • 27
  • 45

2 Answers2

1

In my case the problem was in build.gradle on the CLIENT side (app). I had two compile dependencies referring to the backend, like this:

compile project(path: ':gst-backend', configuration: 'android-endpoints')
compile project(path: ':gst-backend')
Johan Naslund
  • 266
  • 1
  • 6
0

Realized I just needed to reinstall everything and start a fresh project.

booky99
  • 1,436
  • 4
  • 27
  • 45