radarlabs / radar-sdk-android

Android SDK for Radar, the leading geofencing and location tracking platform
https://radar.com
Apache License 2.0
75 stars 22 forks source link

Provide proguard rules to ignore missing Huawei classes #313

Open katiedotson opened 1 year ago

katiedotson commented 1 year ago

Summary

After updating to use the latest version of Gradle, which has the property android.enableR8.fullMode to be true by default, minified builds were failing due to missing proguard rules related to Huawei. Suggestion is to add these to the SDK so they are provided by default.

Code to reproduce

Gradle 8.0 + Targeting SDK 34 minifyEnabled true in build configuration

Steps to reproduce

Build a project using the Radar dependency and default Google location services provider with Gradle 8.0+. The build will fail with a message referencing missing Proguard rules:


Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in .../app/build/outputs/mapping/.../missing_rules.txt

Missing rules text file:


# Please add these rules to your existing keep rules in order to suppress warnings.
# This is generated automatically by the Android Gradle plugin.
-dontwarn com.huawei.hmf.tasks.OnFailureListener
-dontwarn com.huawei.hmf.tasks.OnSuccessListener
-dontwarn com.huawei.hmf.tasks.Task
-dontwarn com.huawei.hms.location.FusedLocationProviderClient
-dontwarn com.huawei.hms.location.Geofence$Builder
-dontwarn com.huawei.hms.location.Geofence
-dontwarn com.huawei.hms.location.GeofenceData
-dontwarn com.huawei.hms.location.GeofenceRequest$Builder
-dontwarn com.huawei.hms.location.GeofenceRequest
-dontwarn com.huawei.hms.location.GeofenceService
-dontwarn com.huawei.hms.location.LocationCallback
-dontwarn com.huawei.hms.location.LocationRequest
-dontwarn com.huawei.hms.location.LocationResult

OS version

Android 14

SDK installation method

Gradle-provided dependency via Maven Central

SDK version

3.8.11

Other information

lmeier commented 1 year ago

Hi @katiedotson, thanks for raising the issue.

In an attempt to replicate, I bumped the gradle for the SDK to 8, and made all the changes required to get the example app to build. I got the example building correctly but without any of the warnings you observed. Here's my work.

Were you able to add the proguard rules to your project? Were you able to successfully build?

Thanks again.

katiedotson commented 1 year ago

Yes, I was able to successfully build after adding the Proguard rules. If the next Radar release will work without them we'll be sure to update. Thank you!