Closed alexander-mai closed 1 year ago
We're also receiving an error like this when building for Android in NativeScript 8.5
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
There is a workaround: add this at the end of the android
block of your app.gradle file:
EDIT: Use the packagingOptions from the following post by @alexander-mai
This works, but it's only a workaround. This issue still needs to be addressed inside NativeScript.
EDIT: This appears to be caused by the @nativescript/pdf dependency.
Different versions of the libc++ library are used in @nativescript/android and the PDF library used in @nativescript/pdf. This leads to the mentioned conflict. The used library 'TalbotGooday:AndroidPdfViewer' would have to be updated so that the same libc++ is used. It was last updated 3 years ago, but there are updated forks.
My workaround is
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'
}
@alexander-mai Thanks, I actually switched to doing that after posting the above. I should have gone back and updated my post.
If there are updated forks, then that's what @nativescript/pdf should use, right? I entered this same issue over there too. I'd rather not have to leave this in the app.gradle.
There is already a an open issue for @nativescript/pdf on plugin repository: https://github.com/NativeScript/plugins/issues/503 facing this problem.
Environment Provide version numbers for the following components (information can be retrieved by running
tns info
in your project folder or by inspecting thepackage.json
of the project):Describe the bug Build fails in Step Gradle Build when / after adding plugin dependencies
Changing the devDependency
@nativescript/android
to8.4.0
is working well.To Reproduce Create an empty nativescript project and just add the plugin @nativescript/pdf
Expected behavior The app schould build
package.json dependencies