Google Play: java.lang.UnsatisfiedLinkError: org.bytedeco.javacpp.avutil #2 - P8 Lite
anonym24 opened this issue · 6 comments
I tested my app on some devices (cpu arm64-v8a or armeabi-v7a) , everything works ok with javacv ffmpeg libs
I also uploaded my app on Google Play Console (closed alpha version).
Google Play Console generates Pre-launch report for every app version
Here what I got
One device failed (Huawei P8 Lite) but I don't understand why, if javacv ffmpeg wasn't correctly set-up in my project then all devices would fail (my own and Google ones)
My app project includes:
javacv/cpp/ffmpeg-3.2.1-1.3
jniLibs
build.gradle
...
ndk {
abiFilters 'armeabi-v7a', 'x86'
}
...
...
dependencies {
...
compile files('libs/ffmpeg-platform-3.2.1-1.3.jar')
compile files('libs/javacpp-1.3.3.jar')
compile files('libs/javacv-1.3.3.jar')
compile files('libs/ffmpeg-3.2.1-1.3.jar')
proguard
-keepattributes *Annotation*
# JavaCV
-keep @org.bytedeco.javacpp.annotation interface * {
*;
}
-keep @org.bytedeco.javacpp.annotation.Platform public class *
-keepclasseswithmembernames class * {
@org.bytedeco.* <fields>;
}
-keepclasseswithmembernames class * {
@org.bytedeco.* <methods>;
}
-keepattributes EnclosingMethod
-keep @interface org.bytedeco.javacpp.annotation.*,javax.inject.*
-keepattributes *Annotation*, Exceptions, Signature, Deprecated, SourceFile, SourceDir, LineNumberTable, Synthetic, EnclosingMethod, RuntimeVisibleAnnotations, RuntimeInvisibleAnnotations, RuntimeVisibleParameterAnnotations, RuntimeInvisibleParameterAnnotations, AnnotationDefault, InnerClasses
-keep class org.bytedeco.javacpp.** {*;}
-dontwarn java.awt.**
-dontwarn org.bytedeco.javacv.**
-dontwarn org.bytedeco.javacpp.**
# end javacv
So everything is set-up correctly 100%, so I don't need to look at #133 (I already read it many times), it seems some sort of specific issue here with this P8 Lite device
If someone have a suggestion what could be a problem or maybe even have such device (P8 Lite) and could test it?
Make sure to use ReLinker:
https://github.com/bytedeco/javacpp-presets/wiki/The-UnsatisfiedLinkError-X-File-%28a-real-experience%29
This usually works around that kind of issue.
Do I have to do this only for .so files (\app\src\main\jniLibs\armeabi-v7a) ? Then which order I have to use with ReLinker for next .so files?
ReLinker.log(logger).recursively().loadLibrary(context, "?");
ReLinker.log(logger).recursively().loadLibrary(context, "?");
...
my list without "lib" and ".so":
avcodec
avformat
avutil
jniavcodec
jniavformat
jniavutil
jniswresample
jniswscale
swresample
swscale
Do I also need to use it for jar files (\app\libs)? Or only for .so files?
p.s. I also cannot find/import org.bytedeco.javacpp.logger.debug
:
What do you mean by "find/import"? Are you getting error when calling System.setProperty("org.bytedeco.javacpp.logger.debug", "true")
?
@saudet I just didn't know how to set it
anyway I just tried this order and it worked:) (all test devices on Google Play worked):
ReLinker.log(logger).recursively().loadLibrary(this, "jniavcodec");
ReLinker.log(logger).recursively().loadLibrary(this, "avcodec");
ReLinker.log(logger).recursively().loadLibrary(this, "jniavformat");
ReLinker.log(logger).recursively().loadLibrary(this, "avformat");
ReLinker.log(logger).recursively().loadLibrary(this, "jniavutil");
ReLinker.log(logger).recursively().loadLibrary(this, "avutil");
ReLinker.log(logger).recursively().loadLibrary(this, "jniswresample");
ReLinker.log(logger).recursively().loadLibrary(this, "swresample");
ReLinker.log(logger).recursively().loadLibrary(this, "jniswscale");
ReLinker.log(logger).recursively().loadLibrary(this, "swscale");
p.s. also we can remove or comment this line in proguard file (https://github.com/bytedeco/javacv/wiki/Configuring-Proguard-for-JavaCV):
# -keepattributes *Annotation*, Exceptions, Signature, Deprecated, SourceFile, SourceDir, LineNumberTable, LocalVariableTable, LocalVariableTypeTable, Synthetic, EnclosingMethod, RuntimeVisibleAnnotations, RuntimeInvisibleAnnotations, RuntimeVisibleParameterAnnotations, RuntimeInvisibleParameterAnnotations, AnnotationDefault, InnerClasses
it works ok without it, so we don't have to try to keep so much
Awesome, thanks for the report!
BTW, feel free to update the wiki page. Everyone has write permissions do it.