相关疑难解决方法(0)

无法合并dex

我有Android Studio Beta.我创建了一个新项目,编译我的旧模块,但是当我尝试启动应用程序时,它没有启动消息:

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
Run Code Online (Sandbox Code Playgroud)

com.android.builder.dexing.DexArchiveMergerException:无法合并dex

但我不知道如何解决这个错误.我用谷歌搜索了几个小时但没有成功.

我的项目是:

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

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-beta6'
        classpath "io.realm:realm-gradle-plugin:3.7.1"
        classpath 'com.google.gms:google-services:3.1.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)

我的应用程序gradle:

    apply plugin: 'com.android.application'

android …
Run Code Online (Sandbox Code Playgroud)

android dex android-studio-3.0

296
推荐指数
16
解决办法
35万
查看次数

仅在运行测试时出现DexIndexOverflowException

我可以在我的调试和发布版本中成功构建和运行我的Android应用程序,没有任何问题.然而,当我尝试运行我的新单元测试(之前从未有过它)时,我得到了可怕的DexIndexOverflowException.我怀疑ProGuard是不是运行我的单元测试,但它是我正常的调试和发布buildTypes.

ProGuard在单元测试运行配置中运行需要做什么?我搜索了Gradle文档,ProGuard文档和Android Studio文档来解决这个问题但我一无所获.

android unit-testing proguard gradle android-gradle-plugin

12
推荐指数
1
解决办法
5925
查看次数

DexArchiveMergerException:无法合并dex - Android Studio 3.0 Stable

我做了:

  • 在"设置" - >"Android SDK" - >"SDK工具" Google Play services中检查并安装v.46
  • 删除文件夹 /.gradle
  • "清洁工程"
  • "重建项目"

错误是:

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
Run Code Online (Sandbox Code Playgroud)

这是命令的输出 gradlew -q app:dependencies>>app_dependencies.txt

运行命令后, gradle :app:assembleDebug --stacktrace 我得到这个:

> Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

 After run of the command
`gradle :app:assembleDebug --stacktrace` 
Error is:

:app:javaPreCompileDebug UP-TO-DATE
:app:compileDebugJavaWithJavacAn exception has occurred in the compiler (1.8.0_152-release). Please file a bug against the Java compiler via the …
Run Code Online (Sandbox Code Playgroud)

android gradle android-gradle-plugin android-studio-3.0

7
推荐指数
1
解决办法
2万
查看次数