Skip to content

Fixing android compatibility#104

Merged
Denis-Averin merged 13 commits intomainfrom
fixing-tests
Mar 23, 2026
Merged

Fixing android compatibility#104
Denis-Averin merged 13 commits intomainfrom
fixing-tests

Conversation

@Denis-Averin
Copy link
Copy Markdown
Contributor

@Denis-Averin Denis-Averin commented Mar 21, 2026

Summary

Fixes #105GenerateApi.generate() crashes on Android with PatternSyntaxException due to unescaped } in replaceAll regex pattern.

Changes

  • Fix Android regex crash: Replace replaceAll() (regex) with replace() (literal) in GenerateApi.java:74
  • Add Android CI: Run unit tests on real Android runtime via Gradle Managed Devices (ATD API 30) to catch ICU regex incompatibilities
  • Add unit tests: New unit tests for GenerateApi, RecognizeApi, and ScanApi with JaCoCo coverage enforcement
  • JDK matrix: CI now tests on both JDK 11 and JDK 21
  • Consolidate workflows: Merged Android test job into ci.yml with needs: test so it only runs after Maven tests pass
  • Caching: Added gradle/actions/setup-gradle@v4 and AVD cache for faster Android CI runs

Android test setup

The android-test/ module reuses existing unit tests from src/test/java/api/ via Gradle sourceSets, running them as instrumented tests on a Pixel 2 API 30 ATD emulator managed by Gradle.

Denis-Averin and others added 12 commits March 21, 2026 17:07
  Switch android-test module from JVM tests to androidTest with Gradle
  Managed Devices (ATD API 30). Reuses existing unit tests from
  src/test/java/api/ via sourceSets. CI workflow boots headless emulator
  via pixel2api30DebugAndroidTest to catch ICU regex incompatibilities.
  Add gson, gson-fire, okhttp, swagger-annotations as implementation
  deps so they're packaged into the test APK. Use exclude instead of
  include to filter out integration test packages that need API tokens.
…orkflow name: field already says "Java CI with Maven" which still fits since it includes both Maven and Android test jobs.
…and wrapper (replaces cache: 'gradle' on setup-java)

2. actions/cache@v4 for AVD — caches ~/.android/avd/* between runs so the ATD system image isn't re-downloaded

  First run populates caches. Subsequent runs skip the ~800MB system image download and AVD creation.
@Denis-Averin Denis-Averin changed the title Fixing flaky tests Fixing android compatibility Mar 23, 2026
@Denis-Averin Denis-Averin requested a review from ivankamkin March 23, 2026 10:34
@Denis-Averin Denis-Averin self-assigned this Mar 23, 2026
@Denis-Averin Denis-Averin marked this pull request as ready for review March 23, 2026 10:52
@Denis-Averin Denis-Averin merged commit c2d6b30 into main Mar 23, 2026
5 checks passed
@Denis-Averin Denis-Averin deleted the fixing-tests branch March 23, 2026 11:26
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.

Android: PatternSyntaxException in GenerateApi due to unescaped } in replaceAll regex

2 participants