fix(android): unbreak build from #8754 + gate Kotlin compile on PRs#8827
Merged
Conversation
#8754 (Android sideload auto-updates) added a bare `success(status)` call in MethodHandler.onMethodCall's InstallSideloadUpdate branch. `success(...)` is not a helper — it resolves to MethodChannel.Result.success() via the implicit receiver of the surrounding `result.runCatching { }` blocks. Inside the `scope.launch { withContext(Dispatchers.Main) { } }` block there is no `result` receiver, so it failed to compile ("Unresolved reference 'success'"). Qualify it as `result.success(status)`. This shipped to main because build-android.yml is workflow_call-only and never ran on PRs — no CI gate compiles app Kotlin. Add android-compile-check.yml: on PRs touching Kotlin/Android (or the Go/deps feeding the gomobile AAR), build the debug APK, which compiles all app Kotlin. Debug-only, so no signing secrets. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a Kotlin compilation break in the Android MethodChannel handler introduced in #8754, and adds a PR-time CI gate to ensure Android/Kotlin compilation is exercised whenever Android- or gomobile-related changes are proposed.
Changes:
- Qualify the MethodChannel result call in
InstallSideloadUpdatetoresult.success(...)to restore Kotlin compilation. - Add a new
android-compile-checkGitHub Actions workflow that runs on PRs touching Android/gomobile-affecting paths and builds the debug APK (compiling all app Kotlin).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| android/app/src/main/kotlin/org/getlantern/lantern/handler/MethodHandler.kt | Fixes the unresolved success(...) call by explicitly using result.success(status) inside the coroutine context. |
| .github/workflows/android-compile-check.yml | Adds a PR-triggered debug APK build to gate Android/Kotlin compilation on relevant PR changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
myleshorton
added a commit
that referenced
this pull request
May 29, 2026
…ts (#8828) The android-compile-check gate (added in #8827) failed at asset bundling — 'No file or variants found for asset: app.env' — because app.env is a declared pubspec asset that only the release workflow decodes (from a secret). Kotlin and Dart compiled fine; the build only choked at bundling. This gate is compile-only and never runs the app, so touch an empty app.env to satisfy bundling without needing the secret. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
main's Android app does not compile. #8754 (Android sideload auto-updates) added a baresuccess(status)call inMethodHandler.onMethodCall'sInstallSideloadUpdatebranch:scope.launch { try { val status = AndroidSideloadInstaller.install(MainActivity.instance, update) withContext(Dispatchers.Main) { success(status) // ← e: Unresolved reference 'success' } } ... }success(...)is not a helper method — every other call site is inside aresult.runCatching { … }block, where the implicit receiverthisis theMethodChannel.Result, sosuccess(...)resolves toMethodChannel.Result.success()(the Flutter API). Inside thisscope.launch { … withContext(Dispatchers.Main) { } }block there is noresultreceiver, so it doesn't resolve and the Kotlin compile fails.Fix
One line — qualify it explicitly:
result.error(...)is already used in the same branch'scatch, soresultis in scope.Why it shipped broken — and the gate
build-android.ymlisworkflow_call-only (invoked by the release flow) and never runs on PRs or pushes. PR CI is only Go CI / CodeQL, neither of which compiles app Kotlin. So this merged undetected.This PR adds
android-compile-check.yml: on PRs touchingandroid/**,lantern-core/**,go.mod/go.sum,Makefile, orpubspec*(i.e. anything that can break Kotlin compilation, directly or via the gomobile AAR), it builds the debug APK — which compiles all app Kotlin. Debug-only, so it needs no keystore/APP_ENVsecrets and skips the AAB/signing/upload. This PR's own run of the gate (it touches both Kotlin and the workflow) doubles as its validation.Verification
Locally on this branch: fresh gomobile AAR +
make android-debug→✓ Built build/app/outputs/flutter-apk/app-debug.apk. Installed on an Android 11 / API 30 emulator, connected the VPN successfully (no crash, traffic routed).