facebookincubator/fbjni

Gradle project build fails on libc++_shared.so conflicts.

Closed this issue · 3 comments

Issue description

Usage of fbjni in conjuction with other libraries can cause conflicts of libc++_shared.so

image

Conflicts can be resolved using

packagingOptions {
        pickFirst "lib/armeabi-v7a/libc++_shared.so"
        pickFirst "lib/arm64-v8a/libc++_shared.so"
        pickFirst "lib/x86/libc++_shared.so"
        pickFirst "lib/x86_64/libc++_shared.so"
    }

but such trick causes crash in runtime, because any dependency can get incompatible version of c++ shared library.

java.lang.UnsatisfiedLinkError: Bad JNI version returned from JNI_OnLoad in "/data/app/~~ZbHqrsKgKEnQcU1uwQ4pnw==/foo.bar.baz-macXtsVqrzK5TJV017tYQw==/HTTP://WEBADDRESS.ELIDED!/lib/arm64-v8a/HTTP://WEBADDRESS.ELIDED": 0
	at java.lang.Runtime.loadLibrary0(Runtime.java:1087)
	at java.lang.Runtime.loadLibrary0(Runtime.java:1008)
	at java.lang.System.loadLibrary(System.java:1664)

libjni should be compiled using static libc++ and published in maven.

System Info

Linux

Basically a duplicate of #69

Basically a duplicate of #69

Yeah, same pain =)

On then we can close this one and keep the conversation there