android - 任务 ':app:mergeLibDexDebug' 执行失败

标签 android flutter kotlin dart apache-poi

我在我的 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 中文件夹。

  1. 转到 repo并下载 .jar文件(在撰写消息时,它们被称为 poi-3.12-android-a.jarpoi-ooxml-schemas-3.12-20150511-a.jar )
  2. 将文件放在项目的 libs 中文件夹 ( <project_name>/app/libs )
  3. 确保您的 build.gradle包括 implementation fileTree(dir: 'libs', include: ['*.jar'])

关于android - 任务 ':app:mergeLibDexDebug' 执行失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61119168/

相关文章:

android - 如何对 ViewPager 中的所有页面使用单个 Fragment?

android - Flutter:如何将 DropdownButton 菜单图标对齐到最右边?

collections - Java Stream.collect 的 Kotlin 等价物是什么?

android - Kotlin 委托(delegate)属性名称在混淆后仍然可见

random - 使用 kotlin 流从列表中获取随机项

android - aapt 不使用绝对路径

java - 通过接口(interface)发送后ArrayList项无法访问

android studio 2.3 即时运行不工作

flutter - 无法将 Row 下拉

dart - 将一个类的属性传递给它的状态类并在文本小部件中使用它