Skip to content

fix: align sample app coroutines with Ktor so visual tests run on device - #11

Closed
kikoso wants to merge 1 commit into
mainfrom
fix/sample-coroutines-version
Closed

kikoso wants to merge 1 commit into
mainfrom
fix/sample-coroutines-version

Conversation

@kikoso

@kikoso kikoso commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

run-instrumentation-test fails on main (and so on every open PR, including docs-only #6): VisualMapSampleTest crashes as soon as the Gemini path makes a request.

java.lang.NoSuchMethodError: No static method invokeOnCompletion$default(...) in class Lkotlinx/coroutines/Job;
	at io.ktor.client.engine.HttpClientEngineKt.createCallContext(HttpClientEngine.kt:239)

:visual-testing pulls in Ktor 3.6.0, which needs kotlinx-coroutines 1.11. The sample app's runtime classpath resolves coroutines 1.9.0 through its AndroidX dependencies, and AGP pins the test APK to the app's runtime versions (kotlinx-coroutines-core:{strictly 1.9.0}), so Ktor runs against 1.9 on the device.

This adds kotlinx-coroutines-android (the existing coroutines version, 1.11.0) to the sample app. debugAndroidTestRuntimeClasspath now resolves {strictly 1.11.0}.

Any consumer app still on coroutines older than 1.11 hits the same crash when using :visual-testing. That is a reason to drop Ktor from the library, which I'll raise separately since it changes the public constructor.

Ran :app:assembleDebug :app:assembleDebugAndroidTest :app:testDebugUnitTest spotlessCheck lint locally: green. The emulator run on this PR is the real check, since I could not run it locally.

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

Coverage (unit tests)

No unit baseline recorded in coverage/history.csv yet, so this run only reports absolute numbers.

Module Line % Change Branch % Change
golden-testing 90.42% new 58.00% new
robolectric-testing 84.06% new 51.71% new
visual-testing 36.54% new 25.07% new
TOTAL 78.88% new 44.01% new

Line and branch coverage from unit test reports. History is recorded in coverage/history.csv after each merge to main.

@kikoso

kikoso commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator Author

Folded into #7, together with a 60s request timeout. On its own this PR fixed the coroutines crash, but the Gemini request then hit CIO's 15s timeout, and Ktor's timeout message includes the request URL, which still carried the API key. #7 moves the key into a header, so the fixes have to land together.

@kikoso kikoso closed this Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants