2017-11-08 9 views
5

私のプロジェクトに「部屋」を追加しようとしています。部屋を使用しているときに「デックスをマージできません」

私はプロジェクトをビルドしようとすると、私はエラーを取得する:

私はすでにやっていること

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

  1. クリーン/再構築プロジェクト
  2. を私がして、 "真multiDexEnabled" を追加defaultConfig {}その後、私はエラーを取得する:

    Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'. java.io.IOException: Can't write [C:\Users\user1\AndroidStudioProjects\git\mobile\app\build\intermediates\multi-dex\debug\componentClasses.jar] (Can't read [C:\Users\user1.gradle\caches\transforms-1\files-1.1\support-core-utils-26.1.0.aar\a6c34f6784b0b6bc5c2fc7a7815426da\jars\classes.jar(;;;;;;**.class)] (Duplicate zip entry [classes.jar:android/support/v4/content/PermissionChecker$PermissionResult.class]))

私は私のプロジェクトから「部屋」を削除した場合、それはエラーなしで構築しています。

私はAndroid Studio 3、gradle build tools 3.0.0を使用しています。

これは私のbuild.gradleです:

apply plugin: 'com.android.application' 
apply plugin: 'me.tatarka.retrolambda' 

buildscript { 
    repositories { 
     mavenCentral() 
    } 

    dependencies { 
     classpath 'me.tatarka:gradle-retrolambda:3.2.5' 
    } 
} 

repositories { 
    mavenCentral() 
} 

android { 
    compileSdkVersion 23 
    buildToolsVersion '26.0.2' 

    defaultConfig { 
     applicationId "trsnet.gtp2.com" 
     minSdkVersion 17 
     targetSdkVersion 23 
     multiDexEnabled true 
    } 

    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 
       'proguard-rules.txt' 
     } 
    } 

    compileOptions { 
     sourceCompatibility JavaVersion.VERSION_1_8 
     targetCompatibility JavaVersion.VERSION_1_8 
    } 

} 

dependencies { 

    compile files('libs/commons-codec-1.9.jar') 
    compile files('libs/ksoap2-android-assembly-3.0.0-jar-with- 
    dependencies.jar') 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile 'com.android.support:cardview-v7:23.2.1' 
    compile 'com.android.support:appcompat-v7:23.2.1' 
    compile 'com.android.support:design:23.2.1' 
    compile 'com.android.support.constraint:constraint-layout:+' 
    compile 'io.reactivex:rxandroid:1.2.1' 
    compile 'io.reactivex:rxjava:1.1.6' 
    compile 'com.jakewharton.rxbinding:rxbinding:0.4.0' 
    implementation 'android.arch.persistence.room:runtime:1.0.0' 
    annotationProcessor 'android.arch.persistence.room:compiler:1.0.0' 
} 
+0

私は 'コンパイル1.0.0-alpha'を' implementation 1.0.0'に変更して、私の問題を修正しました – faztp12

答えて

3

私もこの問題を持っていたし、それが解決するために私にはかなり時間がかかりましたが、私は最終的にそれを得ました。 ROOMはいくつかのサポート-v4ライブラリを使用しています。そのため、ジップエントリが重複しているというエラーが表示されます。私の状況では、ROOMは必要なものよりも前のバージョンのコンポーネントを使用しています。

configurations { 
    all*.exclude group: 'com.android.support', module: 'support-v4' 
} 

私は、これは、それがどんなサポート-V4のコンポーネントを含むからライブラリを妨げている行いますが、その後、あなたが持って見つけたもの:だから(found here)私のために働い何のGradleファイルのルートレベルに以下を追加していますROOMと必要なものの両方に必要なコンポーネントを手動で追加します。どのライブラリが重複しているかを正確に調べる必要がある場合は、these instructionsに従って各ライブラリとその依存関係を調べることができます。

少し無関係な注記:廃止されており、implementationまたはapiと交換しなければならないcompile構成を使用してのGradle 3.0の時点では、素敵な説明はhereを見つけることができます。

関連する問題