Android SDK - Instantiating Credentials object causes crash

Hey, so I have been following through:
https://docs.mongodb.com/realm/tutorial/android-kotlin/#std-label-android-kotlin-tutorial
to create a basic login page.

but the line

var creds = Credentials.emailPassword(username.text.toString(), password.text.toString())

gives the following error:

java.lang.UnsatisfiedLinkError: No implementation found for long io.realm.internal.objectstore.OsAppCredentials.nativeGetFinalizerMethodPtr() (tried Java_io_realm_internal_objectstore_OsAppCredentials_nativeGetFinalizerMethodPtr and Java_io_realm_internal_objectstore_OsAppCredentials_nativeGetFinalizerMethodPtr__)

I am new to Android (but have realm working perfectly fine in other platforms).
I am using:
classpath “io.realm:realm-gradle-plugin:10.9.0”
implementation “io.realm:android-adapters:4.0.0”
in my Gradle files and have
import io.realm.mongodb.Credentials
in my main activity kotlin file.

If anyone has any clue how to fix this it would be much appreciated

You need to call Realm.init(context) before using any other Realm API’s, e.g. like this: realm-java/MyApplication.java at master · realm/realm-java · GitHub

2 Likes

Thanks for the quick reply Christian. You were totally correct, of course. In a roundabout way, so what I had not done was to update my Android Manifest file to use my Application class in which I had initialised all the required goodies.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.