Невозможно объединить ошибку dex при создании моего проекта Android - PullRequest
0 голосов
/ 04 января 2019

Я пытаюсь собрать свой проект для Android и получаю сообщение об ошибке "Unable to merge dex"

Я пробовал разные варианты, которые упоминаются в других постах.Вот некоторые из них:

  • Удалить неиспользуемые библиотеки
  • Добавить multidexenabled = true в файл Gradle
  • Добавить реализацию 'com.android.support:multidex:1.0.3'очистить файл
  • Очистить, удалить папку .gradle и перестроить

Проблема все еще присутствует, и я не уверен, что не так.Пожалуйста, поделитесь своими мыслями.

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

Мой файл app / build.gradle

            apply plugin: 'com.android.application'

            android {
                compileSdkVersion 27

                defaultConfig {
                    applicationId "app.resta.com.restaurantapp"
                    minSdkVersion 23
                    targetSdkVersion 27
                    versionCode 1
                    versionName "1.0"
                    multiDexEnabled true
                }
                buildTypes {
                    release {
                        minifyEnabled false
                        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
                    }
                }
                compileOptions {
                    targetCompatibility 1.7
                    sourceCompatibility 1.7
                }
            }
            repositories {
                maven { url "https://jitpack.io" }
            }
            dependencies {
                compile fileTree(dir: 'libs', include: ['*.jar'])
                testCompile 'junit:junit:4.12'
                implementation 'com.android.support:appcompat-v7:27.0.2'
                implementation 'com.android.support:design:27.0.2'
                implementation 'com.android.support:recyclerview-v7:27.0.2'

                compile 'com.github.PhilJay:MPAndroidChart:v3.0.2'
                implementation 'com.google.firebase:firebase-core:16.0.6'
                implementation 'com.google.firebase:firebase-firestore:17.1.5'
                implementation 'com.google.firebase:firebase-storage:16.0.5'
                implementation 'com.firebaseui:firebase-ui-storage:4.1.0'
                annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
                implementation 'com.android.support:multidex:1.0.3'
            }

            apply plugin: 'com.google.gms.google-services'

1 Ответ

0 голосов
/ 04 января 2019

с вспомогательными библиотеками 27.1.1 он строит:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.github.PhilJay:MPAndroidChart:v3.0.2'
    implementation 'com.google.firebase:firebase-core:16.0.6'
    implementation 'com.google.firebase:firebase-firestore:17.1.5'
    implementation 'com.google.firebase:firebase-storage:16.0.5'
    implementation 'com.firebaseui:firebase-ui-storage:4.1.0'
    implementation 'com.android.support:multidex:1.0.3'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
    testImplementation 'junit:junit:4.12'
}

, если нет, добавьте целое DexArchiveMergerException, а не только это уведомление, которое ничего не говорит.

...