Невозможно объединить Dex с новыми местами Compat SDK от Google - PullRequest
2 голосов
/ 13 марта 2019

Я использую следующий код в моем Gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "abcasdfadsf"
        minSdkVersion 17
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    configurations.all {
        resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
    }

    dexOptions {
        jumboMode true
    }
}

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.squareup.picasso:picasso:2.5.2'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.android.support:support-v4:27.1.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestCompile('com.android.support.test.espresso:espresso-core:3.0.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
    implementation 'com.pnikosis:materialish-progress:1.7'
    implementation 'com.google.firebase:firebase-messaging:17.0.0'

    //implementation 'com.google.android.libraries.places:places-compat:1.0.0'
    //implementation 'com.google.android.libraries.places:places:1.0.0'
    //implementation 'com.google.android.gms:play-services-basement:16.0.1'

    implementation 'com.google.android.gms:play-services-maps:16.0.0'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'com.google.maps.android:android-maps-utils:0.5'
    implementation('com.squareup.retrofit2:retrofit:2.2.0') {
        exclude module: 'com.squareup.okio'
        exclude module: 'com.squareup.okhttp3'
    }
    implementation('com.squareup.retrofit2:converter-gson:2.2.0') {
        exclude module: 'com.squareup.okio'
        exclude module: 'com.squareup.okhttp3'
    }
    implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
    implementation('io.socket:socket.io-client:1.0.0') {
        exclude group: 'org.json', module: 'json'
    }

    //implementation 'com.google.android.gms:play-services-places:16.0.0'
    implementation 'com.sothree.slidinguppanel:library:3.3.0'
    implementation 'me.grantland:autofittextview:0.2.+'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'com.kbeanie:image-chooser-library:1.6.0@aar'
    implementation 'com.soundcloud.android:android-crop:1.0.0@aar'
    implementation 'com.marshalchen.ultimaterecyclerview:library:0.3.16'
    implementation 'com.squareup.retrofit2:converter-scalars:2.2.0'
    implementation 'com.stripe:stripe-android:8.0.0'

    //implementation 'com.google.android.libraries.places:places:1.0.0'
    implementation 'com.google.android.libraries.places:places-compat:1.0.0'
}

apply plugin: 'com.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

Я получаю ошибка

Ошибка: не удалось выполнить задачу ': app: transformDexArchiveWithExternalLibsDexMergerForDebug'. java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: невозможно объединить dex

Я попытался очистить, удалить .gradle и все. Как только я добавлю

implementation 'com.google.android.libraries.places:places-compat:1.0.0'

начинает выдавать ошибку.
Как это исправить?

Ответы [ 2 ]

1 голос
/ 13 марта 2019

Вы пытались настроить мультидекс в своем классе приложений?

  @Override
  protected void attachBaseContext(Context base) {
     super.attachBaseContext(base);
     MultiDex.install(this);
  }
0 голосов
/ 17 июня 2019

Вам необходимо удалить эту строку:

implementation 'com.google.android.gms:play-services-location:16.0.0'
...