Skip to content

fix(ml): preserve Flogger and protobuf metadata in R8 release builds - #13

Merged
raulshma merged 1 commit into
raulshma:mainfrom
ingolfurbjargmundsson-star:fix/mediapipe-r8-object-detection
Oct 27, 2026
Merged

raulshma merged 1 commit into
raulshma:mainfrom
ingolfurbjargmundsson-star:fix/mediapipe-r8-object-detection

Conversation

@ingolfurbjargmundsson-star

Copy link
Copy Markdown
Contributor

Summary

Fixes MediaPipe object detection failing to initialize in R8-optimized release builds of LensCast v0.1.7.

The fix preserves Google Flogger's stack-based caller lookup and protobuf fields accessed through reflection by adding keep rules to app/proguard-rules.pro.

Root cause

The original release failed with:

ExceptionInInitializerError
Caused by: IllegalStateException:
no caller found on the stack for: uk1

Preserving Flogger resolved the first error but exposed a second:

RuntimeException:
Field typeUrl_ for com.google.protobuf.Any not found

Adding the protobuf keep rule resolved this failure.

Verification

Tested on a Samsung Galaxy S10+ running Android 12:

  • Original optimized release reproduced the failure.
  • Unoptimized debug build initialized successfully.
  • Patched optimized release initialized successfully with R8 still enabled.
  • Detection events correctly included person labels.
  • Successful initialization was verified after two additional app restarts.
  • Original LensCast installation and recordings were preserved.

The protobuf rule is intentionally conservative and could be narrowed with further regression testing.

Fixes #12

@raulshma
raulshma merged commit e5289ba into raulshma:main Oct 27, 2026
1 check passed
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.

MediaPipe object detection fails in v0.1.7 release — verified R8 fix

2 participants