无法通过谷歌将dex与新地点compat sdk合并

问题描述 投票:2回答:2

我在我的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'

它开始给我错误。 如何解决这个问题?

java android android-gradle google-places-api
2个回答
1
投票

您是否尝试在应用程序类中设置multidex?

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

0
投票

您需要删除此行:

implementation 'com.google.android.gms:play-services-location:16.0.0'
© www.soinside.com 2019 - 2024. All rights reserved.