Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter : A failure occurred while executing com.android.build.gradle.internal.tasks.MergeNativeLibsTask$MergeNativeLibsTaskWorkAction

  • What went wrong: Execution failed for task ':app:mergeDevelopmentDebugNativeLibs'.

A failure occurred while executing com.android.build.gradle.internal.tasks.MergeNativeLibsTask$MergeNativeLibsTaskWorkAction 2 files found with path 'lib/arm64-v8a/libc++_shared.so' from inputs: - C:\Users\User.gradle\caches\transforms-3\e46e17d597ff8468963db24ef7ea08f6\transformed\jetified-arm64_v8a_debug-1.0.0-74d16627b940bb15e50891f82cad6c3e3465bd6d\arm64-v8a\libc++_shared.so - C:\Users\User.gradle\caches\transforms-3\98560fdb2c1a483439c351cd6deea1fc\transformed\jetified-pdfium-android-1.9.2\jni\arm64-v8a\libc++_shared.so If you are using jniLibs and CMake IMPORTED targets, see https://developer.android.com/r/tools/jniLibs-vs-imported-targets

so this error that preventing me to run my application happen after i upgrade my flutter and all of my dependencies

after that i do this:

packagingOptions {
    resources.excludes.add("META-INF/*")
    // exclude '/lib/arm64-v8a/libc++_shared.so'

}
like image 923
reeeee Avatar asked Sep 06 '25 03:09

reeeee


2 Answers

This issue indeed comes from all the Flutter packages with a PDF viewer on Flutter 3.16.0 and it seems to happen only on Android.

So, the temporary solution is to add this in your app gradle inside android{}:

packagingOptions {
    pickFirst 'lib/x86/libc++_shared.so'
    pickFirst 'lib/x86_64/libc++_shared.so'
    pickFirst 'lib/armeabi-v7a/libc++_shared.so'
    pickFirst 'lib/arm64-v8a/libc++_shared.so'
}
like image 100
Jeshanth Avatar answered Sep 08 '25 00:09

Jeshanth


As Jose Georges says, it's all good when I downgrade my Flutter to version 3.13.9. The issue is with flutter_pdfviewer 1.3.2 and flutter 3.16.0.

like image 23
reeeee Avatar answered Sep 07 '25 23:09

reeeee