代码之家  ›  专栏  ›  技术社区  ›  Muhammad Umar

无法将dex与google的new places compat sdk合并

  •  1
  • Muhammad Umar  · 技术社区  · 6 年前

    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
    

    错误

    Error:Execution failed 对于任务':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

    我试过清理,移除 .gradle

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

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

    1 回复  |  直到 6 年前
        1
  •  1
  •   Beyazid    6 年前

    你试过在你的应用程序类中设置multidex吗?

      @Override
      protected void attachBaseContext(Context base) {
         super.attachBaseContext(base);
         MultiDex.install(this);
      }
    
        2
  •  0
  •   Uriel Frankel    6 年前

    您需要删除此行:

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