You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This repository is being mentioned multiple times as a showcase how to solve different problems when struggling with Android framework.
I came here to learn how to test room with suspendable functions so I checked out LoggedInUserDao with corresponding test LoggedInUserDaoTest
When I tried to run it I imediately got a crash at:
java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: android.content.res.Resources$NotFoundException: Unable to find resource ID #0x7f10002d
at android.app.ActivityThread.installProvider(ActivityThread.java:6396)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5938)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5853)
at android.app.ActivityThread.access$1100(ActivityThread.java:199)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: android.content.res.Resources$NotFoundException: Unable to find resource ID #0x7f10002d
at android.content.res.ResourcesImpl.getResourcePackageName(ResourcesImpl.java:263)
at android.content.res.Resources.getResourcePackageName(Resources.java:1970)
at com.google.android.gms.common.internal.StringResourceValueReader.<init>(Unknown Source:5)
at com.google.firebase.FirebaseOptions.fromResource(com.google.firebase:firebase-common@@17.1.0:160)
at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@17.1.0:248)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(com.google.firebase:firebase-common@@17.1.0:53)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1917)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1892)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(com.google.firebase:firebase-common@@17.1.0:47)
at android.app.ActivityThread.installProvider(ActivityThread.java:6391)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5938)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5853)
at android.app.ActivityThread.access$1100(ActivityThread.java:199)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
I'm an android developer, I got used to runtime crashes so I removed firebase dependency as a workaround to skip its initialization and just run the tests. But then I got:
$ adb shell am instrument -w -m -e package io.plaidapp.designernews.data.database -e debug false io.plaidapp.designernews.test/androidx.test.runner.AndroidJUnitRunner
Connected to process 11665 on device 'Pixel_2_API_28 [emulator-5554]'.
Started running tests
kotlin.UninitializedPropertyAccessException: lateinit property database has not been initialized
at io.plaidapp.designernews.data.database.LoggedInUserDaoTest.tearDown(LoggedInUserDaoTest.kt:61)
at java.lang.reflect.Method.invoke(Native Method)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at androidx.test.internal.runner.junit4.statement.RunAfters.evaluate(RunAfters.java:80)
at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at androidx.test.ext.junit.runners.AndroidJUnit4.run(AndroidJUnit4.java:104)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:389)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2145)
Again runtime crash 👌
So let's add the dependency: kapt "androidx.room:room-compiler:${versions.room}" to make sure room classes there will actually be generated.
After all of that I faced issue that I could solve myself, the test were just stuck:
Does anyone here know how to test LoggedInUserDao class?
The text was updated successfully, but these errors were encountered:
This repository is being mentioned multiple times as a showcase how to solve different problems when struggling with Android framework.
I came here to learn how to test room with suspendable functions so I checked out
LoggedInUserDao
with corresponding testLoggedInUserDaoTest
When I tried to run it I imediately got a crash at:
I'm an android developer, I got used to runtime crashes so I removed firebase dependency as a workaround to skip its initialization and just run the tests. But then I got:
Again runtime crash 👌
So let's add the dependency:
kapt "androidx.room:room-compiler:${versions.room}"
to make sure room classes there will actually be generated.After all of that I faced issue that I could solve myself, the test were just stuck:
Does anyone here know how to test
LoggedInUserDao
class?The text was updated successfully, but these errors were encountered: