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

Unable to start service io.ona.kujaku.services.MapboxOfflineDownloaderService #345

Open
ShivamPokhriyal opened this issue Jun 16, 2020 · 3 comments

Comments

@ShivamPokhriyal
Copy link

We just uploaded our app to playstore using App Bundles and within couple hours we started receiving below crashes:

Fatal Exception: java.lang.RuntimeException: Unable to start service io.ona.kujaku.services.MapboxOfflineDownloaderService@2c791d48 with Intent { cmp=org.commcare.dalvik/io.ona.kujaku.services.MapboxOfflineDownloaderService (has extras) }: com.getkeepsafe.relinker.MissingLibraryException: lib/armeabi/librealm-jni.so
       at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3961)
       at android.app.ActivityThread.access$2300(ActivityThread.java:219)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1833)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:145)
       at android.app.ActivityThread.main(ActivityThread.java:6939)
       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:1404)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
Caused by com.getkeepsafe.relinker.MissingLibraryException: lib/armeabi/librealm-jni.so
       at com.getkeepsafe.relinker.ApkLibraryInstaller.installLibrary(ApkLibraryInstaller.java:85)
       at com.getkeepsafe.relinker.ReLinkerInstance.loadLibraryInternal(ReLinkerInstance.java:180)
       at com.getkeepsafe.relinker.ReLinkerInstance.loadLibrary(ReLinkerInstance.java:136)
       at com.getkeepsafe.relinker.ReLinker.loadLibrary(ReLinker.java:70)
       at com.getkeepsafe.relinker.ReLinker.loadLibrary(ReLinker.java:57)
       at io.realm.internal.RealmCore.loadLibrary(RealmCore.java:60)
       at io.realm.Realm.init(Realm.java:247)
       at io.ona.kujaku.data.realm.RealmDatabase.<init>(RealmDatabase.java:34)
       at io.ona.kujaku.data.realm.RealmDatabase.init(RealmDatabase.java:26)
       at io.ona.kujaku.services.MapboxOfflineDownloaderService.onStartCommand(MapboxOfflineDownloaderService.java:158)
       at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3944)
       at android.app.ActivityThread.access$2300(ActivityThread.java:219)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1833)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:145)
       at android.app.ActivityThread.main(ActivityThread.java:6939)
       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:1404)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)

From this issue it looks like simply upgrading the realm-plugin to 6.1 should be enough(Though few comments seem to suggest that the issue is happening even on the latest realm-plugin) But at least we'll be able to get a better error message with the latest version.

Though, one thing that's constantly bothering me is how this MapboxOfflineDownloaderService is started. My first thought was KujakuNetworkChangeReceiver which can start the service on pre-Nougat devices. And yeah, we're also receiving IllegalStateException: Not allowed to start service Intent, app is in background crashes in android 7+ devices, but that's a different issue and that's already been filed #326 . But I don't think it's the culprit here since I'm getting the above MissingLibraryException even on android 9 devices. And we don't call KujakuLibrary. setEnableMapDownloadResume so that receiver shouldn't work at all on android 7+ devices right?

That being said, perhaps somebody else is starting this service. And we don't even call KujakuLibrary.init until we hit a particular screen, which is not used by any of the users so far. So I'd definitely like to know who's starting this service.

@ekigamba
Copy link
Contributor

@ShivamPokhriyal Sorry for the late reply, have you gotten a solution yet?

@ShivamPokhriyal
Copy link
Author

@ekigamba yeah this was due to some weird caching in our build system due to which the libraries were missing in the app bundle. So good to close this issue.

But I still think it'd be a good idea to update the realm-plugin.

@ekigamba
Copy link
Contributor

@ShivamPokhriyal I'm open to updating the realm plugin or adding a DAO abstraction. I noticed that the realm-plugin adds a couple of MBs to the APK. I believe the extra size can be shed off if the database used on the client app (SQLite, SLQCipher, Realm, Berkeley DB, CouchBase Lite) is reused by the DAO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants