I have a published application that is reporting a java.lang.UnsatisfiedLinkError
crash on some devices. To be more precise, the app crashes on start up with the following log message:
Caused by: java.lang.UnsatisfiedLinkError: Couldn't load qcc: findLibrary returned null
The actual crashing is in the System.loadLibrary("qcc");
instruction, so the app is not finding the library for sure.
The problem is I haven't been able to reproduce the issue myself. Actually the same apk works perfectly on a lot of different devices and versions.
The app uses two C libraries written and compiled by a third person. They have been compiled using the arm-linux-androideabi-4.6
toolchain, and I am integrating them in my project running nkd-build
with the following Android.mk
file:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libqcc
LOCAL_SRC_FILES := qcc/libqcc.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libqpe
LOCAL_SRC_FILES := qpe/libqpe.so
include $(PREBUILT_SHARED_LIBRARY)
The error is being reported on different devices, but all of them at the moment are one of the following Android versions: 2.2, 2.2.1 or 2.2.2.
I think it could be either an architecture issue or a weird problem during installation.
Does anyone know what the problem could be?
UPDATE:
I realized that I could reproduce the problem in an Android 2.2 emulator. This is extra information that I could gather from the logcat.
11:14:59.962 I/dalvikvm( 287): Unable to dlopen(/data/data/.../lib/libqcc.so): Cannot load library: link_image[1995]: failed to link libqcc.so
11:14:59.962 W/dalvikvm( 287): Exception Ljava/lang/UnsatisfiedLinkError;
In this case the problem was that the library was using some C methods that are not supported on Android 2.2
This link was the way to discover the problem.
Methods such as pthread_rwlock_init
are not implemented in the system's C library until Android 2.3 (source).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With