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
While working on the shadow for AsyncTask (#2095), I tried to get it to use more real Android. Because the real Android class stores some static state, I thought it would be a good idea to reset that static state (to the extent possible) in the shadow's @Resetter method. Unfortunately, this causes the JVM to attempt to initialize the AsyncTask class, which in turn tries (indirectly) to reference the main looper, which in turn fails because RobolectricTestRunner has not yet called prepareMainLooper(), which results in the test aborting with an InitializationError or something similar.
I tried to work around this by simply removing the "pre" call to resetStaticState() and leaving only the "post" call, but this caused some other issues with static state that were hard to track down because they depended on the run order.
I seem to recall running into the same issue with another shadow I was working on (possibly ShadowLooper itself).
The text was updated successfully, but these errors were encountered:
While working on the shadow for AsyncTask (#2095), I tried to get it to use more real Android. Because the real Android class stores some static state, I thought it would be a good idea to reset that static state (to the extent possible) in the shadow's
@Resetter
method. Unfortunately, this causes the JVM to attempt to initialize theAsyncTask
class, which in turn tries (indirectly) to reference the main looper, which in turn fails becauseRobolectricTestRunner
has not yet calledprepareMainLooper()
, which results in the test aborting with anInitializationError
or something similar.I tried to work around this by simply removing the "pre" call to resetStaticState() and leaving only the "post" call, but this caused some other issues with static state that were hard to track down because they depended on the run order.
I seem to recall running into the same issue with another shadow I was working on (possibly
ShadowLooper
itself).The text was updated successfully, but these errors were encountered: