Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App Bundle not able to find .so file #6237

Closed
wbervoets opened this issue Oct 19, 2018 · 10 comments
Closed

App Bundle not able to find .so file #6237

wbervoets opened this issue Oct 19, 2018 · 10 comments

Comments

@wbervoets
Copy link

wbervoets commented Oct 19, 2018

Goal

Realm.init(context) initializes the Realm and does not crash the app

Actual Results

A crash occured on Google Nexus 5X device.

Caused by com.b.a.b: librealm-jni.so
at com.getkeepsafe.relinker.ApkLibraryInstaller.sourceDirectories(Unknown Source)
at com.getkeepsafe.relinker.ReLinkerInstance.loadLibraryInternal(Unknown Source)
at com.getkeepsafe.relinker.ReLinkerInstance.loadLibrary(Unknown Source)
at com.getkeepsafe.relinker.ReLinker.loadLibrary(Unknown Source)
at com.getkeepsafe.relinker.ReLinker.loadLibrary(Unknown Source)
at io.realm.internal.RealmCore.loadLibrary(Unknown Source)
at io.realm.Realm.createExpectedSchemaInfo(Unknown Source)

Steps & Code to Reproduce

  • Call Realm.init(context) in the Android Application onCreate().
  • On a LG Nexus 5x device (also see a crashreport from Emulator and Batmobile Defy but these are not important)
  • Our application is distributed as an Android App Bundle. Realm is the only native library we include.

Version of Realm and tooling

Realm version(s): 5.7.0

Realm Sync feature enabled: No

Android Studio version: 3.2.0

Android Build Tools version: 28.0.2

Gradle version: 4.6

Which Android version and device(s): LG Nexus 5X Android v5.0.2 / v5.1.1 / v6.0.1

I assume it happens because of the Android App Bundle, becasuse we didn not have this crash in the previous release where we had one APK with everything included

@cmelchior
Copy link
Contributor

Hi @wbervoets do you have the exact stack trace? It seems that some parts of it was cut out from what you posted. Especially the exact error message?

Also have you access to the APK and are able to verify that the .so file is actually present in it?

@cmelchior cmelchior changed the title Unable to create application : com.b.a.b: librealm-jni.so App Bundle not able to find .so file Oct 30, 2018
@wbervoets
Copy link
Author

The full stacktrace:

Fatal Exception: java.lang.RuntimeException: Unable to create application com.thanksys.x.user.joyn.XApplication: com.b.a.b: librealm-jni.so
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4521)
at android.app.ActivityThread.access$1500(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1339)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

Caused by com.b.a.b: librealm-jni.so
at com.getkeepsafe.relinker.ApkLibraryInstaller.sourceDirectories(Unknown Source)
at com.getkeepsafe.relinker.ReLinkerInstance.loadLibraryInternal(Unknown Source)
at com.getkeepsafe.relinker.ReLinkerInstance.loadLibrary(Unknown Source)
at com.getkeepsafe.relinker.ReLinker.loadLibrary(Unknown Source)
at com.getkeepsafe.relinker.ReLinker.loadLibrary(Unknown Source)
at io.realm.internal.RealmCore.loadLibrary(Unknown Source)
at io.realm.Realm.createExpectedSchemaInfo(Unknown Source)
at com.thanksys.x.user.joyn.utils.RealmUtil.initRealm(Unknown Source)
at com.thanksys.x.user.joyn.XApplication.onCreate(Unknown Source)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4711)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5421)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

It also happens on a Vivo X9 according to the crashlytics logs.
It also seems that both Vivo X9 / Nexus 5X devices were rooted by the user.

Downloading the generated zip for those devices, it contains a config.arm64_v8a.apk which contains lib/arm64-v8a/librealm-jni.so.

@bukenov
Copy link

bukenov commented Nov 16, 2018

I have the same problem

@sumonlbbd
Copy link

I do also have the same problem. Are there any solution to this ? I am also getting a crash on green robot event bus..
Crash details is

Fatal Exception: java.lang.RuntimeException
Unable to start activity ComponentInfo{littleblackbook.com.littleblackbook.lbbdapp.lbb/littleblackbook.com.littleblackbook.lbbdapp.lbb.UI.UGCPlaceTypeActivity}: org.greenrobot.eventbus.EventBusException: Subscriber class littleblackbook.com.littleblackbook.lbbdapp.lbb.Fragments.UGCPlaceTypeFragment and its super classes have no public methods with the @subscribe annotation

@Zhuinden
Copy link
Contributor

Zhuinden commented Jan 8, 2019

@sumonlbbd it sounds like you are missing the Proguard rules for EventBus @Subscribe methods.

-keepattributes *Annotation*
-keepclassmembers class * {
    @org.greenrobot.eventbus.Subscribe <methods>;
}
-keep enum org.greenrobot.eventbus.ThreadMode { *; }
 
# Only required if you use AsyncExecutor
-keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent {
    <init>(java.lang.Throwable);
}

@sumonlbbd
Copy link

@Zhuinden - I have already added all this stuffs in my Proguard file. This are all present.

@Zhuinden
Copy link
Contributor

Zhuinden commented Jan 8, 2019

Then you are registering an Activity to the Bus that has no @Subscribe method.

I think I just used to catch this exception because "who cares", both on register and unregister.

@sumonlbbd
Copy link

@Zhuinden I have added that also. Have added @subscribe annotation at onEvent call .Are there any possible reasons for the same.

@oferDanon
Copy link

Hey @cmelchior ,
I'm also experiencing this crash when using AppBundle, any news on this?
Thanks.

@cmelchior
Copy link
Contributor

The underlying root cause is probably #5977, so I'll fold this issue into that one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants