Home > Net >  Android stack trace shows test code in production Firebase crashlytics
Android stack trace shows test code in production Firebase crashlytics

Time:10-19

The exception is being reported in Firebase crashlytics for the play store version of the app. This happens when the user is landed on the launch activity. Any help would be appreciated. Thanks.

There is no other stack traces available that is helpful to trace the code where it is happening.

Fatal Exception: java.lang.AbstractMethodError: abstract method "void androidx.test.internal.platform.ThreadChecker.checkNotMainThread()"
       at androidx.test.internal.util.Checks.checkNotMainThread(Checks.java:1)
       at androidx.test.espresso.ViewInteraction.postAsynchronouslyOnUiThread(ViewInteraction.java:1)
       at androidx.test.espresso.ViewInteraction.desugaredPerform(ViewInteraction.java:2)
       at androidx.test.espresso.ViewInteraction.perform(ViewInteraction.java:7)
       at androidx.test.tools.crawler.platform.hybrid.HybridStateExtractor.tryExtractingScreenState(HybridStateExtractor.java:7)
       at androidx.test.tools.crawler.platform.hybrid.HybridStateExtractor.getStableScreen(HybridStateExtractor.java:2)
       at androidx.test.tools.crawler.platform.RemotePlatform.handlePerformScrape(RemotePlatform.java:1)
       at androidx.test.tools.crawler.platform.RemotePlatform.messageLoop(RemotePlatform.java:55)
       at androidx.test.tools.crawler.platform.RemotePlatform.lambda$startCrawlAndWaitUntilFinished$0$androidx-test-tools-crawler-platform-RemotePlatform(RemotePlatform.java:1)
       at androidx.test.tools.crawler.platform.RemotePlatform$$ExternalSyntheticLambda1.run(RemotePlatform.java:6)
       at java.lang.Thread.run(Thread.java:764)

No tests nor any UI test dependencies are added in the project. Is there any chance this might be caused by any of the 3rd party libraries? Like FacebookSDK, Braze, Branch or Firebase Crashlytics?

CodePudding user response:

Make absolutely sure that you don't include test code (e.g. espresso) in your production app. Code using these libraries is intended to test your app code, not to be used to build app functionality.

This code should only reside in the app/src/test (unit tests) and app/src/androidTest (instrumentation tests, e.g. using espresso) directories. When setting up these libraries in your build.gradle, make sure to specify the dependency with androidTestImplementation (or testImplementation for unit test libs), like:

androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0-beta01'

This way, you prevent yourself from even using it in the wrong place, i.e. application code.

  • Related