android - Google App Engine: DuplicateFileException -
been using backend on year without problem. today made deployment new computer , of sudden got duplicatefileexception
.
full error:
error:execution failed task ':android: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\\.gradle\caches\modules-2\files-2.1\com.google.appengine\appengine-api-1.0-sdk\1.9.42\c972bc847992e5512eb4338a38cc2392e56760f6\appengine-api-1.0-sdk-1.9.42.jar file2: c:\users\\.gradle\caches\modules-2\files-2.1\com.google.appengine\appengine-endpoints\1.9.42\5c25efed254f8f9846d04b156e68283055efd320\appengine-endpoints-1.9.42.jar
there answer on stack says need add gradle:
dependencies { appenginesdk 'com.google.appengine:appengine-java-sdk:1.9.42' compile 'com.google.appengine:appengine-endpoints:1.9.42' compile ('com.google.appengine:appengine-endpoints-deps:1.9.42'){ exclude "sep_approx_spanish.txt" //added } compile 'javax.servlet:servlet-api:2.5' compile files('src/main/webapp/web-inf/lib/objectify-5.1.12.jar') compile files('src/main/webapp/web-inf/lib/guava-19.0.jar') compile files('src/main/webapp/web-inf/lib/gcm-server-1.0.2.jar') }
however gives me error:
error:could not find method exclude() arguments [sep_approx_spanish.txt] on defaultexternalmoduledependency{group='com.google.appengine', name='appengine-endpoints-deps', version='1.9.42', configuration='default'} of type org.gradle.api.internal.artifacts.dependencies.defaultexternalmoduledependency.
i've looked through client gradle , server, can't find anywhere calling same library twice or that. not sure has happened.
adding android client , backend gradle below:
android:
android { buildtoolsversion '25.0.0' compilesdkversion 23 defaultconfig { multidexenabled = true } sourcesets { main { manifest.srcfile 'androidmanifest.xml' java.srcdirs = ['src'] aidl.srcdirs = ['src'] renderscript.srcdirs = ['src'] res.srcdirs = ['res'] assets.srcdirs = ['assets'] jnilibs.srcdirs = ['libs'] } instrumenttest.setroot('tests') } } dependencies { compile 'com.google.android.gms:play-services-gcm:9.4.0' compile 'com.google.android.gms:play-services-ads:9.4.0' compile 'com.google.code.findbugs:jsr305:2.0.1' compile project(path: ':backend', configuration: 'android-endpoints') } // called every time gradle gets executed, takes native dependencies of // natives configuration, , extracts them proper libs/ folders // packed apk. task copyandroidnatives() { file("libs/armeabi/").mkdirs(); file("libs/armeabi-v7a/").mkdirs(); file("libs/x86/").mkdirs(); configurations.natives.files.each { jar -> def outputdir = null if (jar.name.endswith("natives-armeabi-v7a.jar")) outputdir = file("libs/armeabi-v7a") if (jar.name.endswith("natives-armeabi.jar")) outputdir = file("libs/armeabi") if (jar.name.endswith("natives-x86.jar")) outputdir = file("libs/x86") if (outputdir != null) { copy { ziptree(jar) outputdir include "*.so" } } } } task run(type: exec) { def path def localproperties = project.file("../local.properties") if (localproperties.exists()) { properties properties = new properties() localproperties.withinputstream { instr -> properties.load(instr) } def sdkdir = properties.getproperty('sdk.dir') if (sdkdir) { path = sdkdir } else { path = "$system.env.android_home" } } else { path = "$system.env.android_home" } def adb = path + "/platform-tools/adb" commandline "$adb", 'shell', 'am', 'start', '-n', '.android/androidlauncher' } // sets android eclipse project, using old ant based build. eclipse { // need specify java source sets explicitely, springsource gradle eclipse plugin // ignores nodes added in classpath.file.withxml sourcesets { main { java.srcdirs "src", 'gen' } } jdt { sourcecompatibility = 1.6 targetcompatibility = 1.6 } classpath { plusconfigurations += [project.configurations.compile] containers 'com.android.ide.eclipse.adt.android_framework', 'com.android.ide.eclipse.adt.libraries' } project { name = appname + "-android" natures 'com.android.ide.eclipse.adt.androidnature' buildcommands.clear(); buildcommand "com.android.ide.eclipse.adt.resourcemanagerbuilder" buildcommand "com.android.ide.eclipse.adt.precompilerbuilder" buildcommand "org.eclipse.jdt.core.javabuilder" buildcommand "com.android.ide.eclipse.adt.apkbuilder" } } // sets android idea project, using old ant based build. idea { module { sourcedirs += file("src"); scopes = [compile: [plus: [project.configurations.compile]]] iml { withxml { def node = it.asnode() def builder = nodebuilder.newinstance(); builder.current = node; builder.component(name: "facetmanager") { facet(type: "android", name: "android") { configuration { option(name: "update_property_files", value: "true") } } } } } } }
backend:
buildscript { repositories { jcenter() } dependencies { classpath 'com.google.appengine:gradle-appengine-plugin:1.9.42' } } 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.42' compile 'com.google.appengine:appengine-endpoints:1.9.42' compile 'com.google.appengine:appengine-endpoints-deps:1.9.42' compile 'javax.servlet:servlet-api:2.5' compile files('src/main/webapp/web-inf/lib/objectify-5.1.12.jar') compile files('src/main/webapp/web-inf/lib/guava-19.0.jar') compile files('src/main/webapp/web-inf/lib/gcm-server-1.0.2.jar') } appengine { downloadsdk = true appcfg { oauth2 = true } endpoints { getclientlibsonbuild = true getdiscoverydocsonbuild = true } }
try add following in 'app' build.gradle file:
android { ... packagingoptions { ... exclude 'com/google/appengine/repackaged/org/apache/commons/codec/language/bm/sep_approx_spanish.txt' } }
Comments
Post a Comment