【问题标题】:app:transformDexArchiveWithExternalLibsDexMergerForDebug : Unable to Merge Dex Android Studio 3.0.1应用程序:transformDexArchiveWithExternalLibsDexMergerForDebug:无法合并 Dex Android Studio 3.0.1
【发布时间】:2018-03-04 04:19:24
【问题描述】:

我尝试了几乎所有解决方案,但我认为这是我的项目库所特有的。

这是我的项目级 gradle。

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'

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

allprojects {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
}

这是我的应用级 gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.2'

    defaultConfig {
        applicationId "com.codepath.the_town_kitchen"
        minSdkVersion 15
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    signingConfigs {
        debug {
            storeFile file("keystore/debug.keystore")
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories { mavenCentral() }

repositories {
    mavenCentral()
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')

    compile 'com.android.support:cardview-v7:27.0.2'
    compile 'com.android.support:appcompat-v7:27.0.2'
    compile 'com.android.support:recyclerview-v7:27.0.2'

    compile 'com.squareup.picasso:picasso:2.4.0'
    compile 'com.loopj.android:android-async-http:1.4.6'
    compile 'com.google.android.gms:play-services:6.5.87'
    compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
    compile 'com.facebook.android:facebook-android-sdk:3.21.1'
    compile 'com.github.flavienlaurent.datetimepicker:library:0.0.2'
    compile 'com.parse.bolts:bolts-android:1.+'
    compile 'com.github.johnkil.android-robototextview:robototextview:2.3.0'
    compile fileTree(dir: 'libs', include: 'Parse-*.jar')
    compile 'com.makeramen:roundedimageview:1.5.0'
    compile 'com.stripe:stripe-android:2.0.2'
}

我已尝试将所有库与最新版本同步,还添加了 multiDexEnabled 选项。但是,它仍然无法正常工作。我还可以修改什么来跟踪问题?

我使用条带作为支付网关。我试图弄清楚它的库是否有问题,但我发现没有这样的东西是相对的。

【问题讨论】:

标签: android gradle android-gradle-plugin


【解决方案1】:

我不太确定解决方案。但是,我认为您正在使用的外部库中有不同的支持库版本。您需要定义您在应用程序中使用的支持库的确切版本。所以我认为你需要修改build.gradle,如下所示。

删除repositories { mavenCentral() },因为它已经在另一个地方定义了。

并在您的应用级别build.gradle 中添加以下配置。

configurations.all {
    resolutionStrategy {
        force 'com.android.support:design:27.0.2'
        force 'com.android.support:support-v4:27.0.2'
        force 'com.android.support:appcompat-v7:27.0.2'
    }
}

【讨论】:

    【解决方案2】:

    条带库正在使用支持库版本27.1.0(查看条带根build.gradle),支持设计库27.1.0 是您在https://github.com/stripe/stripe-android/blob/master/stripe/build.gradle#L19 看到的要求

    因此,您需要使用支持库 27.1.0 或从条带中排除支持设计库。

    另一种可能性,compile 'com.google.android.gms:play-services:6.5.87' 不能很好地与最新的支持库配合使用。因此,请尝试使用最新的 google play 服务库。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多