当前位置: 首页 > 知识库问答 >
问题:

错误:任务“:app:dexDebug”在运行时执行失败

淳于涛
2023-03-14

我面临这个运行时错误。它说:

错误:任务“:app:dexDebug”的执行失败。

com.android.ide.common.process.ProcessExcture:org.gradle.process.internal.ExecExc0019:进程'命令'/usr/lib/jvm/java-8-oracle/bin/java"完成非零退出值2

这是我的身材。渐变脚本:

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
useLibrary  'org.apache.http.legacy'

defaultConfig {
    applicationId "com.stratbeans.barium.mobilebarium"
    minSdkVersion 16
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile files('libs/universal-image-loader-1.9.3.jar')
compile files('libs/listviewanimations_lib-core-slh_3.1.0.jar')
compile project(':ListViewAnimations-core')
compile project(':StickyListHeaders')
compile project(':ListViewAnimations-core-slh')

请帮帮我。谢谢!

共有2个答案

郑俊弼
2023-03-14
defaultConfig {
     multiDexEnabled true 
}

在构建中的defaultConfig中添加multiDexEnabled true。格拉德尔<希望这对你有用!

微生俊健
2023-03-14

您应该审核项目中不需要的依赖项,并使用ProGuard删除尽可能多的未使用的代码。

  1. 更改Gradle构建配置以启用Multidex
  2. 修改清单以引用MultiDexApplication类

修改应用程序Gradle生成文件配置,以包括支持库并启用multidex输出。

    android {
    compileSdkVersion 21
    buildToolsVersion "21.1.0"

    defaultConfig {
       applicationId "com.stratbeans.barium.mobilebarium"
       minSdkVersion 16
       targetSdkVersion 23
       versionCode 1
       versionName "1.0"

        // Enabling multidex support.
        multiDexEnabled true
    }
    ...
}

dependencies {
  compile 'com.android.support:multidex:1.0.0'
}

有关详细信息,您可以访问我的答案DexIndexOverflow仅在运行测试时例外

 类似资料: