Skip to content

RFC - feat: add Android native code coverage support#124

Draft
mfazekas wants to merge 3 commits into
callstackincubator:mainfrom
mfazekas:feat/native-android-coverage
Draft

RFC - feat: add Android native code coverage support#124
mfazekas wants to merge 3 commits into
callstackincubator:mainfrom
mfazekas:feat/native-android-coverage

Conversation

@mfazekas
Copy link
Copy Markdown
Contributor

Summary

Adds @react-native-harness/coverage-android package for collecting Kotlin/Java code coverage from Android apps during harness test runs, using JaCoCo offline instrumentation.

  • New packages/coverage-android/ package with Gradle init script, runtime helpers (CoverageHelper + CoverageInitProvider), and jacoco-agent.properties
  • Coverage collector in platform-android pulls .ec files via adb, merges with jacococli.jar (stashed during build), generates XML, converts to lcov
  • Config schema extended with coverage.native.android.modules
  • Harness session dispatch updated to be platform-aware (no iOS regression)

See ANDROID_COVERAGE_GUIDE.md for usage instructions.

Test plan

  • Build playground app with --init-script and verify $jacocoInit in class files
  • Run harness tests with --coverage --harnessRunner android
  • Verify native-coverage.lcov output with non-zero coverage
  • Verify iOS coverage still works unchanged
  • Test on API 29+ emulator (run-as + adb pull path)

Add @react-native-harness/coverage-android package with JaCoCo offline
instrumentation. A Gradle init script instruments Kotlin/Java classes at
build time, and the coverage collector pulls .ec files from the device
and generates lcov reports at test time.
@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 2026

@mfazekas is attempting to deploy a commit to the Callstack Team on Vercel.

A member of the Team first needs to authorize it.

@mfazekas mfazekas changed the title feat: add Android native code coverage support RFC - feat: add Android native code coverage support May 19, 2026
mfazekas added 2 commits May 19, 2026 16:10
- Use allprojects+afterEvaluate instead of projectsEvaluated (too late for source sets)
- Use configureEach for lazily-registered compile tasks
- Fix manifest template to use double-quoted string for ${applicationId}
- Remove redundant BuildConfig guard from CoverageHelper
- Set jacocoCli transitive=false
- Remove ANDROID_COVERAGE_GUIDE.md from repo
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.

1 participant