2016-12-07 31 views
0

私のアプリに問題があります! build.gradle同期とエラーなしで、私はアプリのエラーを実行したいとき!これはエラーです:エラー:タスク 'の実行に失敗しました:Find Me:transformResourcesWithMergeJavaResForDebug'

Error:Execution failed for task ':Find Me:transformResourcesWithMergeJavaResForDebug'.

com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE File1: C:\Users****\workspace\Find Me\libs\httpclient-4.5.1.jar

File2: C:\Users****\workspace\Find Me\libs\httpclient-cache-4.5.1.jar

File3: C:\Users****\workspace\Find Me\libs\httpclient-win-4.5.1.jar

File4: C:\Users****\workspace\Find Me\libs\httpcore-4.4.3.jar

とそのbuild.gradle:

apply plugin: 'com.android.application' 

dependencies { 
    compile fileTree(dir: 'libs', include: '*.jar') 
    compile project(':android-support-v7-appcompat') 
    compile project(':CircularImageView') 
    compile project(':FacebookSDK') 
    compile project(':google-play-services_lib') 
    compile project(':google-play-services_lib') 
    compile project(':FacebookSDK') 
    compile project(':android-support-v7-appcompat') 
    compile project(':CircularImageView') 
} 

android { 
    compileSdkVersion 23 
    buildToolsVersion "25.0.1" 

    sourceSets { 
     main { 
      manifest.srcFile 'AndroidManifest.xml' 
      java.srcDirs = ['src'] 
      resources.srcDirs = ['src'] 
      aidl.srcDirs = ['src'] 
      renderscript.srcDirs = ['src'] 
      res.srcDirs = ['res'] 
      assets.srcDirs = ['assets'] 
     } 

     // Move the tests to tests/java, tests/res, etc... 
     instrumentTest.setRoot('tests') 

     // Move the build types to build-types/<type> 
     // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... 
     // This moves them out of them default location under src/<type>/... which would 
     // conflict with src/ being used by the main source set. 
     // Adding new build types or product flavors should be accompanied 
     // by a similar customization. 
     debug.setRoot('build-types/debug') 
     release.setRoot('build-types/release') 
    } 
} 

compile project(':google-play-services_lib') compile project(':google-play-services_lib') compile project(':FacebookSDK') compile project(':android-support-v7-appcompat') compile project(':CircularImageView') 2回

は、それらを削除し、それぞれ一度だけを使用し、あなたが持っているあなたのgrandleファイルでは、あなた

答えて

0

に感謝します

apply plugin: 'com.android.application' 

dependencies { 
compile fileTree(dir: 'libs', include: '*.jar') 
compile project(':android-support-v7-appcompat') 
compile project(':CircularImageView') 
compile project(':FacebookSDK') 
compile project(':google-play-services_lib') 

} 

android { 
compileSdkVersion 23 
buildToolsVersion "25.0.1" 

sourceSets { 
    main { 
     manifest.srcFile 'AndroidManifest.xml' 
     java.srcDirs = ['src'] 
     resources.srcDirs = ['src'] 
     aidl.srcDirs = ['src'] 
     renderscript.srcDirs = ['src'] 
     res.srcDirs = ['res'] 
     assets.srcDirs = ['assets'] 
    } 

    // Move the tests to tests/java, tests/res, etc... 
    instrumentTest.setRoot('tests') 

    // Move the build types to build-types/<type> 
    // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... 
    // This moves them out of them default location under src/<type>/... which would 
    // conflict with src/ being used by the main source set. 
    // Adding new build types or product flavors should be accompanied 
    // by a similar customization. 
    debug.setRoot('build-types/debug') 
    release.setRoot('build-types/release') 
} 
} 

EDIT:

packagingOptions { 
    exclude 'META-INF/DEPENDENCIES.txt' 
    exclude 'META-INF/LICENSE.txt' 
    exclude 'META-INF/NOTICE.txt' 
    exclude 'META-INF/NOTICE' 
    exclude 'META-INF/LICENSE' 
    exclude 'META-INF/DEPENDENCIES' 
    exclude 'META-INF/notice.txt' 
    exclude 'META-INF/license.txt' 
    exclude 'META-INF/dependencies.txt' 
    exclude 'META-INF/LGPL2.1' 
} 
+0

ありがとう試みるが、それでも同じエラー! – user2003857

+0

@ user2003857プロジェクトをコンパイルする理由を教えてください。これらのファイルを編集していますか? –

+0

@ user2003857私の編集 –

0

@VygintasBが重複した依存関係を削除し、モジュールレベルのbuild.gradleファイルで、このブロックを追加してみてください言ったように、重複ファイルをというエラーがコピーされたAndroidの{}内のこれらの行を追加します。 APK META-INF/LICENSEにので、ちょうどそれらを除外し、

android { 
//..... 
    packagingOptions { 
     exclude 'META-INF/DEPENDENCIES' 
     exclude 'META-INF/NOTICE' 
     exclude 'META-INF/LICENSE' 
     exclude 'META-INF/notice.txt' 
     exclude 'META-INF/license.txt' 
     exclude 'META-INF/dependencies.txt' 
     exclude 'META-INF/DEPENDENCIES.txt' 
     exclude 'META-INF/LICENSE.txt' 
     exclude 'META-INF/NOTICE.txt' 
     }  

    } 
+0

お返事ありがとうございます。お返事ありがとうございます。このエラーが発生しました。エラー:(2、0)プロジェクト ':Find Me'のorg.gradle.api.Projectタイプの引数[build_7m54jl7uaw8y6qoof85j6ic93 $ _run_closure1 @ 41a63d94]のメソッドpackagingOptions()を見つけることができませんでした。 – user2003857

+0

更新されたグラデルファイル – Raghavendra

+0

@ user2003857をどこに置くことができますか?どこにpackagingOptions()ブロックを置いたのですか?グラデルファイルのアンドロイドブロックを入れてください – Raghavendra

関連する問題