Hello friends, I am getting this error while writi...
# android
h
Hello friends, I am getting this error while writing unittesting "java.lang.RuntimeException: Method getMainLooper in android.os.Looper not mocked." Dows anybody have idea what is the cause of it and how to fix it? I am sharing the code in screenshot given below
😶 2
c
You are not using coroutines, right? So setting the main dispatcher does not have any influence on LiveData. You need to use the
InstantTaskExecutorRule
.
A simple stackoverflow search would have given you the answer https://stackoverflow.com/a/70607384
👍 1
h
Okay, let me check it. Thanks Christian for the help.😊