Realm-java: Problem with 2.0.0-SNAPSHOT

Created on 21 Sep 2016  路  3Comments  路  Source: realm/realm-java

2.0.0-SNAPSHOT
Entering RealmConfiguration.java Android Studio says Library Source Code does not match the bytecode for class RealmConfiguration.

In this file:
public static final class Builder {
....
public Builder(Context context) {

Entering RealmConfiguration.class:
public static final class Builder {
....
Builder(Context context) {

In RealmConfiguration.java it's public
In RealmConfiguration.class it's internal

so new RealmConfiguration.Builder(this) does not compile with
Builder(android.content.Context) is not public...

Goal

RealmConfiguration.Builder working

Expected Results

RealmConfiguration.Builder should be public

Actual Results

Error:(16, 49) error: Builder(Context) is not public in Builder; cannot be accessed from outside package

Steps & Code to Reproduce

Describe your current debugging efforts.

Code Sample

RealmConfiguration realmConfiguration = new RealmConfiguration.Builder(this)
.name(Realm.DEFAULT_REALM_NAME)
.schemaVersion(0)
.deleteRealmIfMigrationNeeded()
.build();

Version of Realm and tooling

Realm version(s): 2.0.0-SNAPSHOT

Android Studio version: 2.2

Which Android version and device: Nexus 10

Most helpful comment

You should clean/rebuild and there was a breaking change, the new RealmConfiguration.Builder(Context) constructor was removed, now you need to call Realm.init(Context) from somewhere (application or first activity or something of that sort), and then the configuration hasnew RealmConfiguration.Builder()

All 3 comments

You should clean/rebuild and there was a breaking change, the new RealmConfiguration.Builder(Context) constructor was removed, now you need to call Realm.init(Context) from somewhere (application or first activity or something of that sort), and then the configuration hasnew RealmConfiguration.Builder()

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aschrijver picture aschrijver  路  3Comments

nolanamy picture nolanamy  路  3Comments

wezley98 picture wezley98  路  3Comments

cmelchior picture cmelchior  路  3Comments

harshvishu picture harshvishu  路  3Comments