2017-11-29 8 views
0

プロジェクトをビルドしようとしているときにデクスエラーをマージできません。私は文字通り他のスレッドのすべてのソリューションを試してみましたが、私にとってはうまくいくものは見つかりませんでした...だから、今すぐ複製してください。だからここプロジェクトをビルドするときにdexエラーをマージできません

は、正確なエラーです:

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

マイbuild.gradle(プロジェクト)ファイル:外部として

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 27 
    //buildToolsVersion "26.0.2" 
    defaultConfig { 
     applicationId "com.example.leodr.upgradeadmin" 
     minSdkVersion 15 
     targetSdkVersion 27 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

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.google.code.gson:gson:2.8.2' 
    compile 'com.android.support:appcompat-v7:27.0.1' 
    compile 'com.android.support.constraint:constraint-layout:1.0.2' 
    testCompile 'junit:junit:4.12' 
} 

// Top-level build file where you can add configuration options common to all sub-projects/modules. 

buildscript { 
    repositories { 
     jcenter() 
     google() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:3.0.1' 

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
     google() 
    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 

と私のモジュールbuild.gradleライブラリ私はGSONを使用します。

+0

エラーログに余分な行がある場合は、残りの部分を追加してください。一部のクラスは重複しており、ログに表示されるはずです。また、外部ライブラリを使用していることも知っておく必要があります。 – Toris

+0

それ以上はありません、私は質問にコピーされたエラーだけです。私は "Messages Gradle Build"セクションだけを見ましたか、それとも私がエラーを見ることができる他の場所がありますか? –

+1

なぜあなたのbuildToolsにコメントしましたか? buildToolsVersion '27 .0.1 'を追加してプロジェクトをクリーンアップ –

答えて

0

この

android:name="com.pkg.YouApplication" 

のようなあなたのapllication名properrtyを定義し、あなたのmanifiestファイルにあなたのbuild.gradle

dependencies { 
    compile 'com.android.support:multidex:1.0.1' 
} 

defaultConfig { 
    multiDexEnabled true 

} 

を変更multidex

を有効にしようとしましたは、アプリケーションのクラスでこれを含めます

public class YouApplication extends Application { 

    @Override 
    protected void attachBaseContext(Context base) { 
     super.attachBaseContext(base); 
     MultiDex.install(this); 
    } 

} 
+0

私のために残念ながらうまくいきませんでした... –

関連する問題