Intermittent Android app crash java.lang.UnsatisfiedLinkError: dlopen failed - android

Our app is currently running in TC56 and TC57 devices, and we are observing intermittent crashes in few devices.
[Events]
java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/com.XXX.XXX-9biWE6eu2GZJuAqHQGqPpw==/lib/arm/libcrashmanager-ndk.so" has bad ELF magic
at java.lang.Runtime.loadLibrary0(Runtime.java:1016)
at java.lang.System.loadLibrary(System.java:1657)
at com.XXX.device.crashmanager.ndk.NDKCrashDetector.<init>(NDKCrashDetector.java:3)
at com.XXX.device.crashmanager.CrashDetectionHelper.enableNDKCrashDetection(CrashDetectionHelper.java:1)
at com.XXX.XXX.android.log.CustomCrashReporterImpl.initialise(CustomCrashReporterImpl.java:6)
at com.XXX.XXX.android.XXX.onCreate(XXX.java:5)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1120)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5765)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1669)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6528)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
We came across this which is very similar to our crashes. I have validated we are using
osVersion: 8.1.0 which is greater than what is suggested in answer.
One of the main reason is this is intermittent failure

You're using a library libcrashmanager-ndk that is corrupted in some way. "Bad ELF magic" means that the first 4 bytes (I think 4, may be off on size) of the file are not the magic combo expected to recognize an ELF file. ELF files are linux executable files. The only fix for this is to get a good version of the library (or not to use it at all).

Related

Could not find 'librealm-jni.so'. Looked for: [x86], but only found: []

My app has been working smoothly for the last few months. But since last week I have been getting the following error a lot,
Fatal Exception: java.lang.RuntimeException: Unable to create application com.foo.bar.MyApplication: com.getkeepsafe.relinker.MissingLibraryException: Could not find 'librealm-jni.so'. Looked for: [x86], but only found: [].
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5743)
at android.app.ActivityThread.-wrap1()
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
This issue has 40 crash events affecting 7 users (My app only has less than 3000 installs).
These are the affected devices,
Nexus 5X
HUAWEI WDGF4587
QEMU Standard PC (Q35 + ICH9, 2009) <= Someone experimenting with my apk?
Motorola One Vision (rooted)
for a similar issue,
someone suggested to use android.bundle.enableUncompressedNativeLibs=false
This blog post says that Android won't be able to load 32- and 64-bit native libraries concurrently. In my app, I'm also using other libraries such as uCrop and my own native codes. The solution he suggested is to simply exclude all 64-bit binaries from your APK.
Does anyone know the implications of the above-mentioned fixes?
You specified the cpu architecture of the response in your project. I think it's a cpu architecture configuration issue.

Loading webrtc-client module with fingerprint sensor, make fingerprint sensors system (.so) file not finding

I am working on adding OTG fingerprint sensor implementation with webrtc-client project. Fingerprint sensor library has .so file which I need to add into jniLibs folder. And I have converted webrtc-client android project to library and trying to include that in the project where fingerprint sensor is already implemented, but as soon as I add this module in the project, app starts giving error for fingerprint sensor system.so file, here is the error details:
Process: com.fingerprint.rcapp, PID: 7793
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.fingerprint.rcapp--XpzGpbTo00QmDUMlC48fQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.fingerprint.rcapp--XpzGpbTo00QmDUMlC48fQ==/lib/arm64, /data/app/com.fingerprint.rcapp--XpzGpbTo00QmDUMlC48fQ==/base.apk!/lib/arm64-v8a, /system/lib64, /product/lib64]]] couldn't find "libast2600.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:1067)
at java.lang.Runtime.loadLibrary0(Runtime.java:1007)
at java.lang.System.loadLibrary(System.java:1667)
at com.fingerprint.rcapp.astdev.natives.PfsBioFpJNI.<clinit>(PfsBioFpJNI.java:95)
at com.fingerprint.rcapp.astdev.natives.PfsBioFpJNI.createInstance(PfsBioFpJNI.java:110)
at com.fingerprint.rcapp.astdev.natives.Ast2600.<init>(Ast2600.java:41)
at com.fingerprint.rcapp.LoginActivity.onCreate(LoginActivity.java:98)
at android.app.Activity.performCreate(Activity.java:7955)
at android.app.Activity.performCreate(Activity.java:7944)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3423)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3595)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2147)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:7814)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1068)
I tried searching for similar solutions but nothing worked in my favour, it would be really helpful if someone can help me on this. Thank you.
EDIT
One thing I found out is the socket.io-client library and io.pristine libraries are creating this issue. When I comment out these two libraries, it works just fine but then webrtc-client does not work.
implementation 'com.github.nkzawa:socket.io-client:0.4.2'
api 'io.pristine:libjingle:9127#aar'
EDIT 2
I have figured out the root cause of this issue, the OTG FingerPrint sensor library use 32-bit .so file but io.pristine:libjingle:9127#aar library use 64-bit .so file, so when I am adding this library, it is looking for the fingerprint sensor library in 64-bit libs only. To fix this issues, I am trying to an implementation to either support both 64-bit and 32-bit libraries or ask for 64-bit library from Fingerprint sensor provider.
Fixed this issue by adding an implementation to support both 32-bit and 64-bit libraries.

TensorFlow + AndroidScanner - couldn't find "libopencv_java3.so"

I'm having a problem with combining Tensorflow and AndroidScanner.
I use Tensorflow to display an overlay over the camera feed. I take a picture with the camera, and then send it to a server. It works.
Now I imported the AndroidScannerDemo, I want to use the taken picture and crop/transform it with the newly imported module. It crashes. When I open the ScanActivity (from the AndroidScannerDemo), it tries to load opencv, and never succeeds. The error message is as follows:
FATAL EXCEPTION: main
Process: fr.pacifica.insurancechat.debug, PID: 2139
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/fr.pacifica.insurancechat.debug-OI_d1EANbiczpZEwAHYdkw==/base.apk"],nativeLibraryDirectories=[/data/app/fr.pacifica.insurancechat.debug-OI_d1EANbiczpZEwAHYdkw==/lib/arm64, /data/app/fr.pacifica.insurancechat.debug-OI_d1EANbiczpZEwAHYdkw==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]]] couldn't find "libopencv_java3.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:1011)
at java.lang.System.loadLibrary(System.java:1657)
at com.scanlibrary.ScanActivity.(ScanActivity.java:125)
at java.lang.Class.newInstance(Native Method)
at android.app.Instrumentation.newActivity(Instrumentation.java:1190)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2837)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3046)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1688)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6809)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
When I delete TensorFlow references from gradle/code, the imported module works just fine.
The project you imported, only builds 32-bit versions of libScanner.so, and therefore only uses the 32-bit versions of libopencv_java3.so. In the short run, you can keep that, only set
android {
defaultConfig {
ndk {
abiFilters 'armeabi-v7a'
}
}
}
This will cause your APK run in 32-bit mode on arm64 devices.
In the long run, you should update the Scanner library to build in 64-bit, too. This may have a significant performance gain.
from August 2019, 64-bit support is required for all apps in Play Store
I had the same problem with some mobiles (64 bits processor)
Here is the libs you need for every single arquitecture. You can download it and import manually.
https://github.com/jhansireddy/AndroidScannerDemo/tree/2cd23d3d362d0a6248cf489a79ebc4ba2c425c60/ScanDemoExample/scanlibrary/src/main/libs

Android app loading ARM shared library on x86 device fails

I have a really simple android app. I want to load a shared library called 'libcamera.so' and then call methods via JNI.
I do not own this library and I do not have access to the source code. It was originally compiled for ARM.
An x86 version is not available.
The project can detect the library and correctly shows it in the jniLibs folder.
Within my main activity I am trying to load the 3rd party library like so:
static {
System.loadLibrary("camera");
}
When this line executes, logcat shows the following:
02-06 14:11:38.517 4455-4455/uk.co.test.myApp E/art: dlopen("/data/app/uk.co.test.myApp-2/lib/x86/libcamera.so", RTLD_LAZY) failed: dlopen failed: "/data/app/uk.co.test.myApp-2/lib/x86/libcamera.so" has unexpected e_machine: 40
02-06 14:11:38.519 4455-4455/uk.co.test.myApp E/AndroidRuntime: FATAL EXCEPTION: main
Process: uk.co.test.myApp, PID: 4455
java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/uk.co.test.myApp-2/lib/x86/libcamera.so" has unexpected e_machine: 40
at java.lang.Runtime.loadLibrary(Runtime.java:371)
at java.lang.System.loadLibrary(System.java:988)
at uk.co.test.myApp.MainActivity.<clinit>(MainActivity.java:17)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.Class.newInstance(Class.java:1603)
at android.app.Instrumentation.newActivity(Instrumentation.java:1066)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2226)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5258)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Other 3rd party apps which use this library can run on my x86 device (Epson BT350) so I feel like this should be possible.
I have become aware of something called 'Houdini' which allows ARM apps to run on x86 - I have checked and my device has this library so im confused why its not doing its job. But its also quite likely I dont really understand how Houdini works!
I have tried running on an x86 emulator - same error.
Any ideas would be greatly appreciated.
I solved the problem by forcing my app to only build an armeabi version. I did this by using an abifilter within gradle. I added the following to my defaultConfig
ndk {
abiFilters "armeabi"
}
This will then run on my x86 device because Houdini will kick in and do the translation. Its not ideal because this translation affects performance - but its a start and gets me to the next stage.

Error when trying to install Instant App

I've a multi feature app.
Installed App version works perfectly.
n
Instant App version was working till yesterday. Now I can build it correctly but I get this error when trying to install any of the instant modules.
Does anyone have the same issue ?
I cannot understand the error message:
Failed to finalize session : INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: Failed parse during installPackageLI: Failed to read manifest from /data/app/vmdl138992238.tmp/base.apk: For input string: "otb"
I do not have any otb string.
otb is a the name of a feature module, but not the one I'm tring to install
EDIT:
I tried to rename the module otb to ootb. I got the same error having it "For input string: "ootb""
also I retrieved the logcat stacktrace:
07-01 01:51:37.516 776-817/? W/PackageManager: Failed parse during installPackageLI
android.content.pm.PackageParser$PackageParserException: Failed to read manifest from /data/app/vmdl1025494079.tmp/base.apk
at android.content.pm.PackageParser.parseBaseApk(PackageParser.java:1252)
at android.content.pm.PackageParser.parseClusterPackage(PackageParser.java:1133)
at android.content.pm.PackageParser.parsePackage(PackageParser.java:952)
at android.content.pm.PackageParser.parsePackage(PackageParser.java:966)
at com.android.server.pm.PackageManagerService.installPackageLI(PackageManagerService.java:16828)
at com.android.server.pm.PackageManagerService.installPackageTracedLI(PackageManagerService.java:16767)
at com.android.server.pm.PackageManagerService.-wrap29(Unknown Source:0)
at com.android.server.pm.PackageManagerService$7.run(PackageManagerService.java:14255)
at android.os.Handler.handleCallback(Handler.java:769)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.os.HandlerThread.run(HandlerThread.java:65)
at com.android.server.ServiceThread.run(ServiceThread.java:46)
Caused by: java.lang.NumberFormatException: For input string: "ootb"
at java.lang.Integer.parseInt(Integer.java:608)
at com.android.internal.util.XmlUtils.convertValueToInt(XmlUtils.java:133)
at android.content.res.TypedArray.getInt(TypedArray.java:373)
at android.content.pm.PackageParser.parseActivity(PackageParser.java:4184)
at android.content.pm.PackageParser.parseBaseApplication(PackageParser.java:3612)
at android.content.pm.PackageParser.parseBaseApkCommon(PackageParser.java:2103)
at android.content.pm.PackageParser.parseBaseApk(PackageParser.java:1984)
at android.content.pm.PackageParser.parseBaseApk(PackageParser.java:1236)
at android.content.pm.PackageParser.parseClusterPackage(PackageParser.java:1133) 
at android.content.pm.PackageParser.parsePackage(PackageParser.java:952) 
at android.content.pm.PackageParser.parsePackage(PackageParser.java:966) 
at com.android.server.pm.PackageManagerService.installPackageLI(PackageManagerService.java:16828) 
at com.android.server.pm.PackageManagerService.installPackageTracedLI(PackageManagerService.java:16767) 
at com.android.server.pm.PackageManagerService.-wrap29(Unknown Source:0) 
at com.android.server.pm.PackageManagerService$7.run(PackageManagerService.java:14255) 
at android.os.Handler.handleCallback(Handler.java:769) 
at android.os.Handler.dispatchMessage(Handler.java:98) 
at android.os.Looper.loop(Looper.java:164) 
at android.os.HandlerThread.run(HandlerThread.java:65) 
at com.android.server.ServiceThread.run(ServiceThread.java:46) 
Ok I maybe found the source of the problem for anyone having the same issue.
This may be related to android O SDK (API 26).
Compiling and targeting API 26 works correctly for classical app but is giving this error for instant apps at install time.
Rolling back to compile SDK 25 solved the problem in my case.
I'll wait for the final API/gradle plugin before tryng again.

Categories

Resources