android - 将 Android Studio 2.3.3 更新到 3.0 后无法合并 dex

标签 android android-studio android-gradle-plugin

Android Studio 3.0 更新后无法合并dex。 而且我还尝试了很多来自 stackoverflow 的老问题:-

但这对我不起作用。

FAILURE: Build failed with an exception.

What went wrong: Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

我的应用程序 gradle 文件如下:-

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'
    defaultConfig {
        applicationId "com.example"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 5
        versionName "1.4"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        multiDexEnabled true

        manifestPlaceholders = [onesignal_app_id: "One Signal Key",
                                onesignal_google_project_number: "REMOTE"]
    }

    lintOptions {
        checkReleaseBuilds false
    }

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

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile files('libs/acra-4.5.0.jar')
    compile files('libs/signpost-commonshttp4-1.2.1.1.jar')
    compile files('libs/signpost-core-1.2.1.1.jar')
    compile files('libs/signpost-jetty6-1.2.1.1.jar')
    compile files('libs/twitter4j-core-2.1.6.jar')
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:design:26.1.0'
    compile 'fr.avianey.com.viewpagerindicator:library:2.4.1.1@aar'
    compile 'com.intuit.sdp:sdp-android:1.0.4'
    compile 'com.android.support:cardview-v7:26.1.0'
    compile 'com.google.android.gms:play-services:11.0.2'
    compile 'com.android.support:appcompat-v7:26.1.0'
    compile 'com.android.support:multidex:1.0.0'
    compile 'com.android.support:customtabs:26.1.0'
    compile 'com.android.support:palette-v7:26.1.0'
    compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.+'
    compile 'com.github.amlcurran.showcaseview:library:5.4.3'
    compile 'com.google.android.exoplayer:exoplayer:r1.5.7'
    compile 'com.android.support:support-v4:26.1.0'
    compile 'com.onesignal:OneSignal:[3.6.2, 3.99.99]'
}

最佳答案

删除这条语句: multiDexEnabled 真

关于android - 将 Android Studio 2.3.3 更新到 3.0 后无法合并 dex,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47009243/

相关文章:

android - Admob child 定向设置

android - 改造 api 分解

java - 如何将jcompilo作为gradle依赖项添加到android studio项目

android-studio - 'ACTION_MEDIA_SCANNER_SCAN_FILE :String' is deprecated

android - Gradle 项目同步失败。 Unresolved 依赖关系

android - Android Gradle-库使用调味包名称调用 Activity

android - Gradle,如何从依赖项 jar 文件中排除类/包?

android - 检测区域内的电话

android - 蓝牙丢包怎么恢复??安卓

php - 如何将来自服务器的数据更改为其他语言(php mysql)