2017-03-28 21 views
0

は問題なく年以上のための私のバックエンドを使用して。今日、私は新しいコンピュータから展開を行い、突然のすべては、私がduplicatefileexceptionを得ました。Google App Engineの:DuplicateFileException

全エラー:

Error:Execution failed for 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 

あなたがする必要があるすべてはあなたの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') 
} 

は、しかし、これは私に別のエラーを与える:

私は私のクライアントのGradleとサーバーを介して見てきた
Error:Could not find method exclude() for 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. 

、私はどこでも、私は同じリットルを呼び出しています見つけることができませんibrary倍またはそのような何か。何が起こったのかわかりません。

アンドロイド:

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 the native dependencies of 
// the natives configuration, and extracts them to the proper libs/ folders 
// so they get packed with the 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 { 
       from zipTree(jar) 
       into 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 up the Android Eclipse project, using the old Ant based build. 
eclipse { 
    // need to specify Java source sets explicitely, SpringSource Gradle Eclipse plugin 
    // ignores any 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 up the Android Idea project, using the 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") 
         } 
        } 
       } 
      } 
     } 
    } 
} 

バックエンド:

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

答えて

0

build.gradleファイルあなたの 'アプリ' に以下を追加してください以下のAndroidクライアントとバックエンドのGradleの追加

android { 
    ... 
    packagingOptions { 
     ... 
     exclude 'com/google/appengine/repackaged/org/apache/commons/codec/language/bm/sep_approx_spanish.txt' 
    } 
}