首页 > 解决方案 > 执行另一个模块时任务':android:mergeDexDebug'执行失败

问题描述

尝试运行我的 android libgdx 应用程序时出现错误。

我尝试将 multidex 设置为 true 但这只会带来不同的问题。也使我的缓存无效。当删除该行以实现“client_core”时,它开始工作。我在 IntelliJ 中编程。

android模块的build.gradle

plugins {
    id 'com.android.application'
}

android {
    compileSdkVersion 28
    buildToolsVersion "28.0.3"
    defaultConfig {
        applicationId "de.unkn0wn.pong"
        minSdkVersion 18
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
    }
}

configurations { natives }

dependencies {
    implementation project(":client_core") //Commenting this line out "fixes" the problem
    implementation "com.badlogicgames.gdx:gdx-backend-android:1.9.10"
    natives "com.badlogicgames.gdx:gdx-platform:1.9.10:natives-armeabi"
    natives "com.badlogicgames.gdx:gdx-platform:1.9.10:natives-armeabi-v7a"
    natives "com.badlogicgames.gdx:gdx-platform:1.9.10:natives-arm64-v8a"
    natives "com.badlogicgames.gdx:gdx-platform:1.9.10:natives-x86"
    natives "com.badlogicgames.gdx:gdx-platform:1.9.10:natives-x86_64"
    natives "com.badlogicgames.gdx:gdx-freetype-platform:1.9.10:natives-armeabi"
    natives "com.badlogicgames.gdx:gdx-freetype-platform:1.9.10:natives-armeabi-v7a"
    natives "com.badlogicgames.gdx:gdx-freetype-platform:1.9.10:natives-arm64-v8a"
    natives "com.badlogicgames.gdx:gdx-freetype-platform:1.9.10:natives-x86"
    natives "com.badlogicgames.gdx:gdx-freetype-platform:1.9.10:natives-x86_64"
}
...

client_core 模块的 build.gradle

plugins {
    id 'java'
}

dependencies {
    compile project(':core')
    implementation "com.badlogicgames.gdx:gdx-freetype:1.9.10"
}

在模拟器或真机上尝试在 IntelliJ 中运行时出现以下错误:

Execution failed for task ':android:mergeDexDebug'
Could not resolve all files for configuration ':android:debugRuntimeClasspath'
Failed to transform artifact 'client_core.jar (project :client_core)' to match attributes {artifactType=android-dex, dexing-is-debuggable=true, dexing-min-sdk=18, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.version=11, org.gradle.usage=java-runtime-jars}
Execution failed for DexingTransform: /home/marcel/Dokumente/Pong/client_core/build/libs/client_core.jar

标签: javaandroidgradlelibgdx

解决方案


推荐阅读