Ошибка при решении проблемы gradle ... Ошибка: не удалось выполнить задачу ': app: transformDexArchiveWithExternalLibsDexMergerForDebug' - PullRequest
0 голосов
/ 03 мая 2018

Возникает проблема при запуске приложения, оно показывает ошибку: не удалось выполнить задачу ': app: transformDexArchiveWithExternalLibsDexMergerForDebug'.

java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Невозможно объединить ошибку dex. Я перепробовал все доступные ответы, но не смог найти решения, чтобы решить мою проблему, поэтому, пожалуйста, помогите мне с ним. Я попытался очистить и восстановить проект, также все версии библиотек одинаковы, но пока не могу решить мою проблему. Заранее спасибо.

Мой build.gradle:

android {
    compileSdkVersion 27
    defaultConfig {

        minSdkVersion 19
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    dexOptions {
        javaMaxHeapSize "4g"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        targetCompatibility 1.8
        sourceCompatibility 1.8
    }
}
configurations {
    all*.exclude group: 'com.android.support', module: 'support-v4'
    all*.exclude group: 'com.google.android.gms', module: 'play-services'
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.github.johnpersano:supertoasts:2.0'
    implementation 'com.github.mmoamenn:ProgressImage_Android:0.0.2'
    implementation 'com.github.ybq:Android-SpinKit:1.1.0'
    implementation 'jp.wasabeef:blurry:2.1.1'
    implementation 'com.loopj.android:android-async-http:1.4.9'
    implementation 'com.google.code.gson:gson:2.8.0'
    implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
    implementation 'com.github.stfalcon:smsverifycatcher:0.3.1'
    implementation 'de.hdodenhof:circleimageview:2.1.0'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.3.1'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'in.gauriinfotech:commons:1.0.8'
    implementation 'com.github.chenupt.android:springindicator:1.0.2@aar'
    implementation 'com.google.android.gms:play-services-places:15.0.0'
    implementation 'com.google.android.gms:play-services-location:15.0.0'
    implementation 'com.google.firebase:firebase-messaging:15.0.0'
    implementation 'com.google.firebase:firebase-core:15.0.0'
    implementation 'com.github.siyamed:android-shape-imageview:0.9.+@aar'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
apply plugin: 'com.google.gms.google-services'

МОЙ проект. Gradle:

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.google.gms:google-services:3.2.0'

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

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}

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

Ответы [ 3 ]

0 голосов
/ 03 мая 2018

Я столкнулся с той же проблемой сегодня и обновил Firebase до 15.0.2 (у меня был firebase-сообщения только в моем проекте), и он работал нормально. Поскольку вы используете больше сервисов Firebase, обновите все ваши зависимости до последних версий . Удачи.

0 голосов
/ 03 мая 2018

Что сработало для меня, так это то, что я перевернул Play Services и версии Fire Base до 11.8.0, и теперь он работает нормально.

0 голосов
/ 03 мая 2018

SDK Firebase для Android теперь имеют независимые номера версий, что позволяет для более частых и гибких обновлений.

Обновите все ваши зависимости Firebase до последней версии (по состоянию на 2 мая 2018 года):

 Firebase Core          com.google.firebase:firebase-core:15.0.2
    Ads                 com.google.firebase:firebase-ads:15.0.0
  Analytics             com.google.firebase:firebase-analytics:15.0.2
 App Indexing           com.google.firebase:firebase-appindexing:15.0.0
 Authentication         com.google.firebase:firebase-auth:15.1.0
Cloud Firestore         com.google.firebase:firebase-firestore:16.0.0
Cloud Functions         com.google.firebase:firebase-functions:15.0.0
Cloud Messaging         com.google.firebase:firebase-messaging:15.0.2
Cloud Storage           com.google.firebase:firebase-storage:15.0.2
Crash Reporting         com.google.firebase:firebase-crash:15.0.2
Crashlytics             com.crashlytics.sdk.android:crashlytics:2.9.1
Invites                 com.google.firebase:firebase-invites:15.0.2
Performance Monitoring  com.google.firebase:firebase-perf:15.1.0
Realtime Database       com.google.firebase:firebase-database:15.0.0
Remote Config           com.google.firebase:firebase-config:15.0.2

Примечание к выпуску: https://firebase.google.com/support/release-notes/android

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...