As seen in the official documentation on how to use Realm
// Initialize Realm
Realm.init(context);
// Get a Realm instance for this thread
Realm realm = Realm.getDefaultInstance();
I added dependencie to my project
classpath "io.realm:realm-gradle-plugin:2.0.2"
I can use this library normally but static method init apparently does not exist. Can someone post an example of how to initialize and save example object to database using this library? There's really not too many tutorials and the usage looks really easy after you manage to fire it up. Realm initialization sets up default configuration right? So is there a way to bypass that static init and set it manually?
--EDIT
When I'm trying to execute this code
RealmConfiguration realmConfiguration = new RealmConfiguration.Builder(this).build();
I get
Error:(33, 49) error: Builder(Context) is not public in Builder; cannot be accessed from outside package
This constructor no longer exists:
RealmConfiguration realmConfiguration = new RealmConfiguration.Builder(this).build();
Use this instead:
RealmConfiguration realmConfiguration = new RealmConfiguration.Builder().build();
The example you refer to should have been updated as well?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With