UnsatisfiedLinkError exception in TightDB:loadLibrary
Hi guys,
I found the following in my crash logs. Unfortunately it just says java.lang.ExceptionInInitializerError. Any ideas on this?
java.lang.ExceptionInInitializerError
at io.realm.Realm.(Realm.java:108)
at io.realm.Realm.createAndValidate(Realm.java:366)
at io.realm.Realm.create(Realm.java:355)
at io.realm.Realm.getInstance(Realm.java:314)
at io.realm.Realm.getInstance(Realm.java:193)
at com.my.app.common.ApplicationModule.provideRealm(ApplicationModule.java:108)
at com.my.app.common.ApplicationModule$$ModuleAdapter$ProvideRealmProvidesAdapter.get(ApplicationModule$$ModuleAdapter.java:388)
at com.my.app.common.ApplicationModule$$ModuleAdapter$ProvideRealmProvidesAdapter.get(ApplicationModule$$ModuleAdapter.java:352)
at com.my.app.activities.MyActivity$$InjectAdapter.injectMembers(MyActivity$$InjectAdapter.java:86)
at com.my.app.activities.MyActivity$$InjectAdapter.injectMembers(MyActivity$$InjectAdapter.java:23)
at dagger.ObjectGraph$DaggerObjectGraph.inject(ObjectGraph.java:281)
at com.my.app.MyApplication.inject(MyApplication.java:69)
at com.my.app.common.BaseActivity.onCreate(BaseActivity.java:53)
at com.my.app.activities.MyActivity.onCreate(MyActivity.java:153)
at android.app.Activity.performCreate(Activity.java:5047)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2056)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2117)
at android.app.ActivityThread.access$700(ActivityThread.java:134)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1218)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4867)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
at dalvik.system.NativeStart.main(NativeStart.java)
Caused by: java.lang.UnsatisfiedLinkError: Couldn't load tightdb-jni: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:365)
at java.lang.System.loadLibrary(System.java:535)
at io.realm.internal.TightDB.loadLibrary(TightDB.java:144)
at io.realm.internal.SharedGroup.(SharedGroup.java:32)
at io.realm.Realm.(Realm.java:108)
at io.realm.Realm.createAndValidate(Realm.java:366)
at io.realm.Realm.create(Realm.java:355)
at io.realm.Realm.getInstance(Realm.java:314)
at io.realm.Realm.getInstance(Realm.java:193)
at com.my.app.common.ApplicationModule.provideRealm(ApplicationModule.java:108)
at com.my.app.common.ApplicationModule$$ModuleAdapter$ProvideRealmProvidesAdapter.get(ApplicationModule$$ModuleAdapter.java:388)
at com.my.app.common.ApplicationModule$$ModuleAdapter$ProvideRealmProvidesAdapter.get(ApplicationModule$$ModuleAdapter.java:352)
at com.my.app.activities.MyActivity$$InjectAdapter.injectMembers(MyActivity$$InjectAdapter.java:86)
at com.my.app.activities.MyActivity$$InjectAdapter.injectMembers(MyActivity$$InjectAdapter.java:23)
at dagger.ObjectGraph$DaggerObjectGraph.inject(ObjectGraph.java:281)
at com.my.app.MyApplication.inject(MyApplication.java:69)
at com.my.app.common.BaseActivity.onCreate(BaseActivity.java:53)
at com.my.app.activities.MyActivity.onCreate(MyActivity.java:153)
at android.app.Activity.performCreate(Activity.java:5047)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2056)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2117)
at android.app.ActivityThread.access$700(ActivityThread.java:134)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1218)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4867)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
at dalvik.system.NativeStart.main(NativeStart.java)
Hi @tspecht
It seems that Realm has trouble loading the c++ library. Which you can see in this line:
Couldn't load tightdb-jni: findLibrary returned null
What device are you testing on and with what version of Realm? Also are you using Android Studio or Eclipse?
@cmelchior thanks for getting back. I assume the Realm version was still 0.7.3 (just shipped the update to 0.7.4 yesterday). I'm using Android Studio to develop & deploy my applications. In addition, I haven't encountered the problems on my test devices but instead got them from my crash reporting tool. They occur on a wide variety of devices (Samsung, Huawai, Sony) and are also not limited to a specific system version (occurring mostly on 4.1.2, but also on 4.4.2 and 4.2.1). Is this of any help?
We would be very interested in knowing the exact models of those phone. Can you compile a list of the most frequent ones together with Android version. That would be incredible helpful.
Sure, everything I can do ;) Unfortunately I can't get the OS version per phone :/
Samsung: -GT I8190 (63%) -Galaxy S Advance (15%) -GT I8160 (7%)
Huawai: -G525 U00 (66%) -G610 U20 (33%)
Sony: -D2403 (100%)
Thank you very much. Now we has some concrete phones to check on. I will keep you posted.
Same here. I post the full stacktrace:
java.lang.UnsatisfiedLinkError: Couldn't load tightdb-jni from loader dalvik.system.PathClassLoader[dexPath=/data/app/org.wepush.traffico2-4.apk,libraryPath=/data/app-lib/org.wepush.traffico2-4]: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:358)
at java.lang.System.loadLibrary(System.java:526)
at io.realm.internal.TightDB.loadLibrary(TightDB.java:144)
at io.realm.internal.SharedGroup.<clinit>(SharedGroup.java:32)
at io.realm.Realm.<init>(Realm.java:108)
at io.realm.Realm.createAndValidate(Realm.java:366)
at io.realm.Realm.create(Realm.java:355)
at io.realm.Realm.getInstance(Realm.java:314)
at io.realm.Realm.getInstance(Realm.java:193)
It occurs on Samsung S4 (I9505) equipped with Android 4.4.2 (Realm version: 0.73.1). Hope it helps.
I got reports about the same crashes on Samsung devices. Unfortunately I have no logcat available right now, but since it just crashes on Samsung phones it's probably the same bug. This is really causing problems here; do you already know the reason and can give us a rough date for a fixing update? Thanks in advance!
Do you guys have any clue if this happens consistently on these phones? Or just sometimes?
On Mon, Dec 8, 2014 at 4:57 PM, an-k [email protected] wrote:
I got reports about the same crashes on Samsung devices. Unfortunately I have no logcat available right now, but since it just crashes on Samsung phones it's probably the same bug. This is really causing problems here; do you already know the reason and can give us a rough date for a fixing update? Thanks in advance!
— Reply to this email directly or view it on GitHub https://github.com/realm/realm-java/issues/620#issuecomment-66136286.
I actually am not experiencing this anymore in the current version of my app!
Which Realm version is that using?
On Mon, Dec 8, 2014 at 11:16 PM, tspecht [email protected] wrote:
I actually am not experiencing this anymore in the current version of my app!
— Reply to this email directly or view it on GitHub https://github.com/realm/realm-java/issues/620#issuecomment-66198188.
@bmunkholm 0.74.x
@an-k : Any details appreciated. Realm version, crashlog, specific devices? Reproducable?
Hi @an-k and @arcadefire : We have tried to test on a lot of different devices (through a web service with many devices) without seeing the problem. tspect is not seing this anymore either. So:
- Do you still experience this?
- Is it consistently happening on the phones in question (i.e. reproduceable with the right phone), please list them
- Which Realm version are you using?
Thanks a lot for your work, guys and sorry for the late response! It's constantly happening on Samsung S4 mini and Note 4 (4.4.2 / 4.4.4), versions 0.73.1 and 0.75.1. But I'm not 100% sure it's realm that causes the crash, it just suited @tspecht 's report perfectly. I managed to get remote logcats in a few hours, then it should be clear.
Big sorry to you guys, the crashes did not confirm this issue.
After a lot of investigating the following turned out as the reason:
My model contains List<Item> itemListGson and RealmList<Item> itemListRealm. This is a necessary workaround I found to make use of Retrofit+GSON (which fills the itemListGson). Just before storing it in realm the list is copied to itemListRealm. Kinda dirty, I know, but its just a workaround unitil realm supports JSON parsing / object initialization by default. And it did work great - so far.
Anyways: On the test Samsung devices on Android 4.4.X GSON crashed - apparently because of the non-serializable class field RealmList<Item> itemListRealm.
edit: To avoid this, just configure the used Gson by building it via Gson gson = GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
So this issue was not confirmed here. Thanks a lot for your work and even more for your brilliant support!
Ok - thanks for the feedback - glad we can help! We will close this one for now then.