2017-01-02 36 views
3

実行中にエラー実行はタスクに失敗しました「:アプリ:transformResourcesWithMergeJavaResForDebug」
だから私は継続的に私のプロジェクトを実行しようとしている時にGradleのビルドエラーを受けています。私は他のソリューションで検索しましたし、いくつかの追加と言う:実行エラー:実行は、タスクに失敗しました「:アプリ:transformResourcesWithMergeJavaResForDebug」

packagingOptions { 
    exclude 'META-INF/NOTICE' 
    exclude 'META-INF/LICENSE' // will not include LICENSE file 
    // as noted by @Vishnuvathsan you may also need to include 
    // variations on the file name. It depends on your dependencies. 
    // Some other common variations on notice and license file names 
    exclude 'META-INF/notice' 
    exclude 'META-INF/notice.txt' 
    exclude 'META-INF/license' 
    exclude 'META-INF/license.txt' 
} 

をしかし、それは以下のようにme.Theエラーのために動作しません: エラー:実行タスクに失敗しました「:アプリ:transformResourcesWithMergeJavaResForDebug」。

com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/rxjava.properties

**File1: E:\Workspace_Android\TravelStory\app\build\intermediates\exploded-aar\cn.bmob.android\bmob-sdk\3.5.0\jars\classes.jar 
File2: C:\Users\Prometheus\.gradle\caches\modules-2\files-2.1\io.reactivex\rxjava\1.2.1\4e4cfa4adc74521d5966799fa5ab70b733552f68\rxjava-1.2.1.jar** 

私はFile2のを削除しようとしたが、コンパイル後/再作成したファイルをGradleの。
Studioバージョン2.2.3
Gradleのバージョンであるとして、以下の2.2.3

私のGradleファイルの内容です:

apply plugin: 'com.android.application' 
apply plugin: 'android-apt' 

android { 
    compileSdkVersion 25 
    buildToolsVersion "25.0.2" 
    defaultConfig { 
     applicationId "com.example.travelstory.travelstory" 
     minSdkVersion 15 
     targetSdkVersion 25 
     versionCode 1 
     versionName "1.0" 
     multiDexEnabled true; 
    } 

    packagingOptions { 
     exclude 'META-INF/NOTICE' 
     exclude 'META-INF/LICENSE' // will not include LICENSE file 
     // as noted by @Vishnuvathsan you may also need to include 
     // variations on the file name. It depends on your dependencies. 
     // Some other common variations on notice and license file names 
     exclude 'META-INF/notice' 
     exclude 'META-INF/notice.txt' 
     exclude 'META-INF/license' 
     exclude 'META-INF/license.txt' 
    } 

    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
    configurations.all { 
     resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.1' 
    } 
} 

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    compile 'com.android.support:appcompat-v7:25.1.0' 
    compile 'com.android.support:design:25.0.1' 
    compile 'com.android.support:multidex:1.0.1' 
    //屏幕自动适配 
    compile 'com.zhy:autolayout:1.4.5' 
    //注解框架 
    compile 'com.jakewharton:butterknife:8.4.0' 
    apt 'com.jakewharton:butterknife-compiler:8.4.0' 
    //6.0权限rx 
    compile 'com.tbruyelle.rxpermissions:rxpermissions:[email protected]' 
    //RxJava RxLifecycle生命周期管理 
    compile 'com.trello:rxlifecycle:1.0' 
    compile 'com.trello:rxlifecycle-components:1.0' 
    //3.5.0:请务必查看下面注释[1] 
    compile ('cn.bmob.android:bmob-sdk:3.5.0') 
    //   { 
    //  exclude group: 'io.reactivex:rxjava:1.1.6' 
    // } 
    //如果你想应用能够兼容Android6.0,请添加此依赖(org.apache.http.legacy.jar) 
    compile 'cn.bmob.android:http-legacy:1.0' 
    //bmob-push:Bmob的推送包 
    compile 'cn.bmob.android:bmob-push:0.8' 
    //多fragment多模块Activity 
    compile 'me.yokeyword:fragmentation:0.9.3' 
    // 如果想使用SwipeBack 滑动边缘退出Fragment/Activity功能,请再添加下面的库 
    compile 'me.yokeyword:fragmentation-swipeback:0.7.9' 
} 

答えて

3

あなたは、エラーがについて警告されたファイルを除外しません。

com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/rxjava.properties

ここで不満はこれだけ明示的にこのファイルを除外するために、あなたのpackageOptionsブロックを更新META-INF/rxjava.propertiesです。

packagingOptions { 
    exclude 'META-INF/rxjava.properties' 
    // ... and any other excludes go here 
} 
1

更新このコードであなたのGradle:ライブラリ

の重複がある場合にこれが起こる

packagingOptions { 
     exclude 'META-INF/DEPENDENCIES.txt' 
     exclude 'META-INF/NOTICE' 
     exclude 'META-INF/NOTICE.txt' 
     exclude 'META-INF/LICENSE' 
     exclude 'META-INF/LICENSE.txt' 
    } 

関連する問題