NativeScript / plugins

@nativescript plugins to help with your developments.
https://docs.nativescript.org/plugins/index.html
Apache License 2.0
189 stars 107 forks source link

[@nativescript/pdf] In NS 8.5, building for Android fails with a "Execution failed for task ':app:mergeDebugNativeLibs'." when using @nativescript/pdf #503

Closed JWiseCoder closed 1 year ago

JWiseCoder commented 1 year ago

We recently upgraded our app to NS 8.5, and we found that our app fails to build on Android.

Execution failed for task ':app:mergeDebugNativeLibs'.
2 files found with path 'lib/arm64-v8a/libc++_shared.so' from inputs:
 - {home directory}/.gradle/caches/transforms-3/5f9aea1bacbd967e47cda037c65bd0e3/transformed/jetified-PdfiumAndroid-1.0.1/jni/arm64-v8a/libc++_shared.so
 - {home directory}/.gradle/caches/transforms-3/cd760d28106a1b4d4e96396bcec235da/transformed/jetified-nativescript-optimized-with-inspector/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

Command ./gradlew failed with exit code 1

This is apparently being caused by the 'com.github.TalbotGooday:AndroidPdfViewer:3.1.0-beta.3' include.

What can be done to fix this?

insytes commented 1 year ago

@JWiseCoder I was facing the same issue after upgrading to NativeScript 8 using FFMPEG.

The solution is to add these lines to your App_Resources/Android/app.gradle

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'
    }
}

More information about this issue can be found here.

JWiseCoder commented 1 year ago

@insytes Thanks. I'm already doing that exact thing. It works, but I'd rather not have to put that in my app.gradle forever. I think @nativescript/pdf should update the pdf library it's using so there isn't this conflict with the libc++.

insytes commented 1 year ago

@insytes Thanks. I'm already doing that exact thing. It works, but I'd rather not have to put that in my app.gradle forever. I think @nativescript/pdf should update the pdf library it's using so there isn't this conflict with the libc++.

@JWiseCoder of course it's always nice when a third party dependency is maintained and that can be an option... not so much luck with ffmpeg :)