java.lang.IllegalStateException: Call `Realm.init(Context)` before creating a RealmConfiguration

tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    GitHub comment 3879#266525599

    GitHub | 4 months ago | CaptMustache
    java.lang.IllegalStateException: Call `Realm.init(Context)` before creating a RealmConfiguration

Root Cause Analysis

  1. java.lang.IllegalStateException

    Call `Realm.init(Context)` before creating a RealmConfiguration

    at io.realm.RealmConfiguration$Builder.<init>()
  2. io.realm
    RealmConfiguration$Builder.<init>
    1. io.realm.RealmConfiguration$Builder.<init>(RealmConfiguration.java:399)
    2. io.realm.RealmConfiguration$Builder.<init>(RealmConfiguration.java:394)
    2 frames
  3. com.arnowouter.badger
    DatabaseTest.setupDatabase
    1. com.arnowouter.badger.Database.Database.<init>(Database.java:38)
    2. com.arnowouter.badger.DatabaseTest.setupDatabase(DatabaseTest.java:27)
    2 frames
  4. Java RT
    Method.invoke
    1. java.lang.reflect.Method.invoke(Native Method)
    1 frame
  5. JUnit
    JUnitCore.run
    1. org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    2. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    3. org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    4. org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
    5. org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    6. org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    7. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    8. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    9. org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    10. org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    11. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    12. org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    13. org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    14. org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    15. org.junit.runners.Suite.runChild(Suite.java:128)
    16. org.junit.runners.Suite.runChild(Suite.java:27)
    17. org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    18. org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    19. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    20. org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    21. org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    22. org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    23. org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    24. org.junit.runner.JUnitCore.run(JUnitCore.java:115)
    24 frames
  6. android.support.test
    AndroidJUnitRunner.onStart
    1. android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:59)
    2. android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:262)
    2 frames
  7. Android Platform
    Instrumentation$InstrumentationThread.run
    1. android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1970)
    1 frame