【发布时间】:2023-05-17 19:33:01
【问题描述】:
我正在尝试构建我的应用程序,但收到此错误。我已经重建、清理了项目并重置了 Android Studio。这是问题的截图:
代码错误:
错误:任务 ':app:transformClassesWithDexForDebug' 执行失败。 com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: Unable to pre-dex 'C:\Users\User-1.gradle\caches\modules-2\files-2.1 \stax\stax-api\1.0.1\49c100caf72d658aca8e58bd74a4ba90fa2b0d70\stax-api-1.0.1.jar' 到 'C:\Users\User-1\Documents\workspace\WebUpHosting\app\build\intermediates\transforms\dex\调试\文件夹\1000\10\stax-api-1.0.1_4deeb811af0ea67608aa694ead937d7c9ac36202'
问题在于我在构建时,因为我的应用程序编译正确。有谁知道我怎么解决这个问题?
更新:
构建.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.webuphosting.app"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
dexOptions {
preDexLibraries = 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 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.daimajia.easing:library:2.0@aar'
compile 'com.daimajia.androidanimations:library:2.3@aar'
compile 'com.android.support:support-v4:26.+'
compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
compile 'com.android.support:recyclerview-v7:26.0.+'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile "com.squareup.retrofit2:converter-simplexml:2.3.0"
testCompile 'junit:junit:4.12'
}
【问题讨论】: