我在我的 Flutter Android 应用程序中添加了第 3 方 Apache POI JAR 以实现一些功能。但是在我尝试运行时添加 POI 库后出现以下错误:
Execution failed for task ':app:mergeLibDexDebug'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Failed to transform artifact 'poi-4.1.2.jar (project :poi-4.1.2)' to match attributes {artifactType=android-dex, dexing-enable-desugaring=true, dexing-is-debuggable=true, dexing-min-sdk=21, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
> Execution failed for DexingWithClasspathTransform: /Users/chandra/Developer/globaldata/android/poi-4.1.2/poi-4.1.2.jar.
> Error while dexing.
最佳答案
遇到了同样的问题,可以使用 andruhon 修复它的 repo 解决方案。
基本上,依赖项将替换为 .jar
文件放在您项目的 libs
中文件夹。
- 转到 repo并下载
.jar
文件(在撰写消息时,它们被称为poi-3.12-android-a.jar
和poi-ooxml-schemas-3.12-20150511-a.jar
) - 将文件放在项目的
libs
中文件夹 (<project_name>/app/libs
) - 确保您的
build.gradle
包括implementation fileTree(dir: 'libs', include: ['*.jar'])
关于android - 任务 ':app:mergeLibDexDebug' 执行失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61119168/