[Android] App initialization throws an error

I have installed Realm on new android project and import realm as follow:

import io.realm.Realm

I’m still not able to initialize the app. App is throwing an error
Am I missing something

val app: App = App(AppConfiguration.Builder(appID).build())

However, I can still do Realm.init(this) without error

PS: I tried importing import io.realm.mongodb.App but MongoDB import is throwing an error saying Unresolved reference: mongodb

@Safik_Momin What version are you using? You should be able to clone the tutorial repo, build, and run - I just tested it out and it works for me.

Thank you for the update @Ian_Ward. It looks like realm android documentation doesn’t mention to add implementation "io.realm:android-adapters:4.0.0" in the dependencies section. This fixes the above problem for me.

I’m migrating an older project that was working fine with full sync, based on the quick-start.
I ran into a similar issue. A ton of clean/rebuilds later I got it to work.

Seems like the final solution was updating android-adapters. I changed
implementation “io.realm:android-adapters:3.0.0”
implementation “io.realm:android-adapters:4.0.0”

I also still had to add these 2 imports explicitly.

import io.realm.mongodb.App
import io.realm.mongodb.AppConfiguration

At any rate, thanks @Safik_Momin for asking this earlier and posting that final implementation. Probably saved me another few hours of digging.

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