gpt4 book ai didi

java - 错误 :Execution failed for task ':app:packageAllDebugClassesForMultiDex' . Apache POI Android

转载 作者:行者123 更新时间:2023-12-02 03:44:16 24 4
gpt4 key购买 nike

我尝试将 Apache POI 包含在我的 Android 项目中,但出现以下错误:

Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: org/apache/xmlbeans/xml/stream/Location.class

我的build.gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion '23.0.2'

defaultConfig {
applicationId "com.example.alexandra.kavb"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE.txt'
}

dexOptions {
javaMaxHeapSize "2g"
}
}

dependencies {
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.google.android.gms:play-services-appindexing:8.1.0'
compile files('libs/commons-codec-1.10.jar')
compile files('libs/commons-logging-1.2.jar')
compile files('libs/log4j-1.2.17.jar')
compile files('libs/poi-3.14-20160307.jar')
compile files('libs/poi-ooxml-3.14-20160307.jar')
compile files('libs/poi-ooxml-schemas-3.14-20160307.jar')
compile files('libs/xmlbeans-2.6.0.jar')
compile 'com.android.support:multidex:1.0.1'
}

我的失败日志:

Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2301Library UP-TO-DATE
:app:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42301Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBasement810Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:collectDebugMultiDexComponents
:app:packageAllDebugClassesForMultiDex FAILED
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: org/apache/xmlbeans/xml/stream/Location.class
Information:BUILD FAILED
Information:Total time: 2.68 secs
Information:1 error
Information:0 warnings
Information:See complete output in console

我已经设法找到 xmlbeans.jar 的错误。但删除它会导致文档创建不起作用。

最佳答案

你能做的是:

  1. 解压 jar文件。 (只需将 .jar 扩展名更改为 .zip
  2. 这将删除重复的文件。
  3. 重新创建 jar使用jar cf xmlbeans.jar -C (unzipped folder path) . (注意,命令末尾有一个点)
  4. 使用这个重新生成的jar

关于java - 错误 :Execution failed for task ':app:packageAllDebugClassesForMultiDex' . Apache POI Android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36485442/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com