AndroidTest with Kotlin Code fails

Hi, we’ve recently introduced Kotlin and AndroidTest somehow started to fail.
Looks like there are 2 issues

  1. AndroidTest can not reference Kotlin code
  2. Window can not be focused and fails (Probably this happens because the first test fails with 1. issue )

It succeeds locally so I’m not sure why this happens. Any idea?

_Does a “Rebuild” help?

_Does a rebuild without caches help?
No. Tried clear cache but did not work.

_If you have multiple different build configurations (workflows), does the issue affect all/more than one?

Only using one workflow

If it’s an issue which happens sporadically, what’s the frequency? (e.g. Once a day ; about x% of the builds) :

Does upgrading the build Step to the latest version help? :

When did the issue start? :
A few days ago > handleBannerClick_openWebView[android-24(AVD) - 7.0] FAILED 
	java.lang.NullPointerException: Attempt to invoke virtual method 'kotlin.Unit' on a null object reference
	at > handleBannerClick_openSearch[android-24(AVD) - 7.0] FAILED 
	java.lang.RuntimeException: Waited for the root of the view hierarchy to have window focus and not be requesting layout for over 10 seconds. If you specified a non default root matcher, it may be picking a root that never takes focus. Otherwise, something is seriously wrong. Selected Root:
	Root{application-window-token=android.view.ViewRootImpl$W@f60d6da, window-token=android.view.ViewRootImpl$W@f60d6da, has-window-focus=false, layout-params-type=1, layout-params-string=WM.LayoutParams{(0,0)(fillxfill) sim=#120 ty=1 fl=#85810100 pfl=0x20000 wanim=0x1030465 needsMenuKey=2}, decor-view-string=DecorView{id=-1, visibility=VISIBLE, width=768, height=1280, has-focus=true, has-focusable=true, has-window-focus=false, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2}}

Thank you in advance

Are you running this on Firebase Test Lab? If not, try and see if it passes there.

1 Like

Hmm, it did not pass the test on Firebase Test lab. It should be another issue. Do you have any clue why this happens?

1 Like

It’s an issue with your app/test. Debugging would require source code access. Since it reproduces on firebase, the problem isn’t related to bitrise.

1 Like

@tomoima525 if you’d need additional assistance please ping us through the onsite chat on with the link/url of the build which we should look into!

Thanks! I still haven’t got the way to solve it, but I guess it is issue with our code. I’ll close this for now.

@tomoima525 let us know if we can help with anything!

Also, just wanted to highlight that these guides can help with local debugging / reproducing the issue locally: