Android Can't load vlcjni library (libVLC)

2019-08-30 07:05发布

问题:

I can't use

implementation 'de.mrmaffen:libvlc-android:2.1.12@aar' 

if the set minifyEnable to true.

The error message is

Can't load vlcjni library: java.lang.UnsatisfiedLinkError: JNI_ERR returned from JNI_OnLoad in "/data/app//lib/arm64/libvlcjni.so"

How can I use minifyEnable true with libvlc?

回答1:

if you obfuscate the libvlc there is no way for the native code to find the necessary classes and methods so it returns a JNI_ERR. You just need to exclude the libvlc from ProGuard, add this line in progaurd file

-keep class org.videolan.libvlc.** { *; }