android / android-test

An extensive framework for testing Android apps
https://android.github.io/android-test
Apache License 2.0
1.16k stars 315 forks source link

Crash: NoSuchMethodError (handleException) in Kotlin.coroutines.CoroutineExceptionHandler in android.test.tools.crawler #2155

Closed AaronMT closed 9 months ago

AaronMT commented 9 months ago

We recently upgraded to coroutines 1.8.0 https://github.com/Kotlin/kotlinx.coroutines/releases/tag/1.8.0 and are seeing runtime crashes on Test Lab's Robo Crawler (android.test.tools.crawler).

Not sure if this is the right spot to file an issue about this (test.tools.crawler), but does this mean androidx.test.tools.crawler needs to target 1.8.0 as this method is not found at runtime?

If unrelated, not sure if we need to start adding -keep interface kotlinx.coroutines.CoroutineExceptionHandler { *; } or equivalent to pro guard, as this seems to be happening on optimized builds that we want to have crawled.

java.lang.RuntimeException: Exception while trying to handle coroutine exception
     FATAL EXCEPTION: EditToolbar-thread-1
Process: org.mozilla.fenix, PID: 8372
java.lang.RuntimeException: Exception while trying to handle coroutine exception
    at coil.util.-Logs.handleUncaughtCoroutineException(Logs.kt:32)
    at kotlinx.coroutines.CoroutineExceptionHandlerKt.handleCoroutineException(CoroutineExceptionHandler.kt:35)
    at kotlinx.coroutines.StandaloneCoroutine.handleJobException(Builders.common.kt:3)
    at kotlinx.coroutines.JobSupport.finalizeFinishingState(JobSupport.kt:105)
    at kotlinx.coroutines.JobSupport.tryMakeCompleting(JobSupport.kt:239)
    at kotlinx.coroutines.JobSupport.makeCompletingOnce$kotlinx_coroutines_core(JobSupport.kt:5)
    at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:14)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:32)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:111)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    at java.lang.Thread.run(Thread.java:923)
    Suppressed: java.lang.RuntimeException: Exception while trying to handle coroutine exception
        at kotlinx.coroutines.CoroutineExceptionHandlerKt.handleCoroutineException(CoroutineExceptionHandler.kt:28)
        ... 10 more
        Suppressed: java.util.ConcurrentModificationException
            at java.util.TreeMap$PrivateEntryIterator.nextEntry(TreeMap.java:1212)
            at java.util.TreeMap$KeyIterator.next(TreeMap.java:1266)
            at mozilla.components.feature.toolbar.ToolbarAutocompleteFeature$2.invokeSuspend(ToolbarAutocompleteFeature.kt:89)
            at mozilla.components.feature.toolbar.ToolbarAutocompleteFeature$2.invoke(ToolbarAutocompleteFeature.kt:20)
            at mozilla.components.browser.toolbar.AsyncFilterListener$invoke$1.invokeSuspend(BrowserToolbar.kt:46)
            at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:9)
            ... 4 more
    Caused by: java.lang.NoSuchMethodError: No interface method handleException(Lkotlin/coroutines/CoroutineContext;Ljava/lang/Throwable;)V in class Lkotlinx/coroutines/CoroutineExceptionHandler; or its super classes (declaration of 'kotlinx.coroutines.CoroutineExceptionHandler' appears in /data/app/~~9T6mRjP2eVImxY7vTlbjKg==/androidx.test.tools.crawler-y5xVBFr1jsDS7CkGFvTmIg==/base.apk)
        at kotlinx.coroutines.CoroutineExceptionHandlerKt.handleCoroutineException(CoroutineExceptionHandler.kt:11)
        ... 10 more
Caused by: java.lang.NoSuchMethodError: No interface method handleException(Lkotlin/coroutines/CoroutineContext;Ljava/lang/Throwable;)V in class Lkotlinx/coroutines/CoroutineExceptionHandler; or its super classes (declaration of 'kotlinx.coroutines.CoroutineExceptionHandler' appears in /data/app/~~9T6mRjP2eVImxY7vTlbjKg==/androidx.test.tools.crawler-y5xVBFr1jsDS7CkGFvTmIg==/base.apk)
    at coil.util.-Logs.handleUncaughtCoroutineException(Logs.kt:19)
brettchabot commented 9 months ago

androidx.test.tools.crawler is maintained by the firebase test lab team. I'd suggest following up on https://firebase.google.com/support

WoYang commented 8 months ago

I had the same problem this week