android / android/health-samples
Release build of ExerciseSampleCompose crashes
- Dominant language
- Kotlin
- Stars
- 346
- Forks
- 183
- PR merge metrics
- No merged PRs in 30d
Description
**Which sample is this for?**
ExerciseSampleCompose
**Describe the bug**
When built in release mode, the example crashes on startup with:
```
2025-11-15 22:24:53.011 2913-2922 Binder com.example.exercisecompose W Caught a RuntimeException from the binder stub implementation. (Ask Gemini)
java.lang.RuntimeException: Field exerciseInfo_ for u1.T0 not found. Known fields are [public u1.b0 u1.T0.e, public static final u1.T0 u1.T0.f, public static volatile y2.v u1.T0.g]
at y2.W.J(Unknown Source:69)
at y2.W.B(Unknown Source:714)
at y2.W.A(Unknown Source:4)
at y2.b0.a(Unknown Source:122)
at y2.w.n(Unknown Source:18)
at O1.a.createFromParcel(Unknown Source:24)
at android.os.Parcel.readTypedObject(Parcel.java:4325)
at p1.a.onTransact(Unknown Source:54)
at android.os.Binder.execTransactInternal(Binder.java:1426)
at android.os.Binder.execTransact(Binder.java:1365)
```
With `-dontobfuscate` I get:
```
2025-11-15 22:08:52.203 10599-10610 Binder com.example.exercisecompose W Caught a RuntimeException from the binder stub implementation. (Ask Gemini)
java.lang.RuntimeException: Field bitField0_ for androidx.health.services.client.proto.ResponsesProto$ExerciseInfoResponse not found. Known fields are [public androidx.health.services.client.proto.DataProto$ExerciseInfo androidx.health.services.client.proto.ResponsesProto$ExerciseInfoResponse.exerciseInfo_, public static final androidx.health.services.client.proto.ResponsesProto$ExerciseInfoResponse androidx.health.services.client.proto.ResponsesProto$ExerciseInfoResponse.DEFAULT_INSTANCE, public static volatile com.google.protobuf.GeneratedMessageLite$DefaultInstanceBasedParser androidx.health.services.client.proto.ResponsesProto$ExerciseInfoResponse.PARSER]
at com.google.protobuf.MessageSchema.reflectField(Unknown Source:69)
at com.google.protobuf.MessageSchema.newSchemaForRawMessageInfo(Unknown Source:905)
at com.google.protobuf.MessageSchema.newSchema(Unknown Source:4)
at com.google.protobuf.Protobuf.schemaFor(Unknown Source:122)
at com.google.protobuf.GeneratedMessageLite.parseFrom(Unknown Source:18)
at androidx.fragment.app.FragmentState$1.createFromParcel(Unknown Source:30)
at android.os.Parcel.readTypedObject(Parcel.java:4207)
at androidx.health.services.client.impl.internal.ExerciseInfoCallback.onTransact(Unknown Source:54)
at android.os.Binder.execTransactInternal(Binder.java:1396)
at android.os.Binder.execTransact(Binder.java:1335
```
When I add `-keep class * extends com.google.protobuf.GeneratedMessageLite { *; }` to `proguard-rules.pro`, the error is gone.
**To Reproduce**
Steps to reproduce the behavior:
1. Switch to release build variant
2. Start application in Wear OS Emulator API 35
3. See error in logcat
**Expected behavior**
Application does not crash.
**Device Info (please complete the following information):**
- Device: Pixel Watch 1 LTE, Wear OS Emulators API 35 & 36
- OS: Wear OS 5.1 and 6
**Additional context**
This seems related to https://github.com/android/health-samples/issues/62#issuecomment-1303250881
Contributor guide
Research direction
Start by reproducing the release variant crash in the ExerciseSampleCompose sample on a Wear OS API 35 or 36 emulator. Inspect proguard-rules.pro and the generated protobuf classes referenced in the stack trace, then rebuild and verify that startup and the ExerciseInfo callback no longer crash in logcat.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- build-system, mobile
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100