Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HealthConnect - Permission Dialog not working in release mode

App crashes when the app is running in release mode with proguard enabled.

Here is the Crash report.

Fatal Exception: java.lang.IllegalArgumentException: Unknown data type name h0
   at android.os.Parcel.createExceptionOrNull(Parcel.java:2429)
   at android.os.Parcel.createException(Parcel.java:2409)
   at android.os.Parcel.readException(Parcel.java:2392)
   at android.os.Parcel.readException(Parcel.java:2334)
   at androidx.health.platform.client.service.IHealthDataService$Stub$Proxy.getGrantedPermissions(IHealthDataService.java:414)
   at androidx.health.platform.client.impl.ServiceBackedHealthDataClient.getGrantedPermissions$lambda-1(ServiceBackedHealthDataClient.kt:93)
   at androidx.health.platform.client.impl.ServiceBackedHealthDataClient.$r8$lambda$hhWerw-hyBNCC_kPGtX4mZNDQdM(ServiceBackedHealthDataClient.kt)
   at androidx.health.platform.client.impl.ServiceBackedHealthDataClient$$InternalSyntheticLambda$0$605e77fbbfc877805d8dd88d131a334eb9370ed10712fd7118bc908c2d0b7ca2$0.execute(ServiceBackedHealthDataClient.java:6)
   at androidx.health.platform.client.impl.ipc.Client$3.execute(Client.java:279)
   at androidx.health.platform.client.impl.ipc.internal.ServiceConnection.execute(ServiceConnection.java:243)
   at androidx.health.platform.client.impl.ipc.internal.ServiceConnection.enqueue(ServiceConnection.java:200)
   at androidx.health.platform.client.impl.ipc.internal.ConnectionManager.handleMessage(ConnectionManager.java:123)
   at android.os.Handler.dispatchMessage(Handler.java:102)
   at android.os.Looper.loopOnce(Looper.java:201)
   at android.os.Looper.loop(Looper.java:288)
   at android.os.HandlerThread.run(HandlerThread.java:67)

Any Proguard rules should I need to add for health Connect API?

like image 789
B'havdip Dhameliya Avatar asked Sep 10 '25 22:09

B'havdip Dhameliya


1 Answers

Aug. 3, 2022:

As of version 1.0.0-alpha03, this has been fixed on the library's end.

Links :

  • https://developer.android.com/jetpack/androidx/releases/health#health-connect-client-1.0.0-alpha03
  • https://android-review.googlesource.com/c/platform/frameworks/support/+/2153498/2/health/health-connect-client/proguard-rules.pro

For the meantime time, you can add these rules into your proguard file:

-keep public class androidx.health.** {
  public protected private *;
}
-dontwarn androidx.health.**

It is quite overarching to ignore the entire lib at the moment, but at least it gets your project to build under release.

like image 89
Paul John Parreno Avatar answered Sep 13 '25 13:09

Paul John Parreno