Execution failed for task ':app:mergeLibDexDebug'

Viewed 1708

I have added 3rd party Apache POI JAR in my Flutter Android app to achieve some features. But after adding POI library when I try to run getting following error:

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.
1 Answers

Got the same issue, was able to fix it by using andruhon's repo solution. Basically, the dependency will be substituted with .jar files placed in you project's libs folder.

  1. Go to the repo and download the .jar files (at the time of writing the message they are called poi-3.12-android-a.jar and poi-ooxml-schemas-3.12-20150511-a.jar)
  2. Place the files in your project's libs folder (<project_name>/app/libs)
  3. Make sure your build.gradle includes implementation fileTree(dir: 'libs', include: ['*.jar'])
Related