flutter-radar icon indicating copy to clipboard operation
flutter-radar copied to clipboard

Android release build failed

Open codestronaut opened this issue 10 months ago • 3 comments

Hi! I found something strange. I got the following error while building AAB for release, but this error does not happen when running. Please kindly help.

Flutter version: 3.27.1

warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
ERROR: Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in /Users/.../missing_rules.txt.
ERROR: R8: Missing class com.google.android.play.core.integrity.IntegrityManagerFactory (referenced from: void io.radar.sdk.RadarVerificationManager.warmUpProviderAndFetchTokenFromGoogle(long, java.lang.String, kotlin.jvm.functions.Function2))
Missing class com.google.android.play.core.integrity.StandardIntegrityManager$PrepareIntegrityTokenRequest$Builder (referenced from: void io.radar.sdk.RadarVerificationManager.warmUpProviderAndFetchTokenFromGoogle(long, java.lang.String, kotlin.jvm.functions.Function2))
Missing class com.google.android.play.core.integrity.StandardIntegrityManager$PrepareIntegrityTokenRequest (referenced from: void io.radar.sdk.RadarVerificationManager.warmUpProviderAndFetchTokenFromGoogle(long, java.lang.String, kotlin.jvm.functions.Function2))
Missing class com.google.android.play.core.integrity.StandardIntegrityManager$StandardIntegrityToken (referenced from: void io.radar.sdk.RadarVerificationManager.fetchTokenFromGoogle(java.lang.String, kotlin.jvm.functions.Function2) and 1 other context)
Missing class com.google.android.play.core.integrity.StandardIntegrityManager$StandardIntegrityTokenProvider (referenced from: com.google.android.play.core.integrity.StandardIntegrityManager$StandardIntegrityTokenProvider io.radar.sdk.RadarVerificationManager.standardIntegrityTokenProvider and 3 other contexts)
Missing class com.google.android.play.core.integrity.StandardIntegrityManager$StandardIntegrityTokenRequest$Builder (referenced from: void io.radar.sdk.RadarVerificationManager.fetchTokenFromGoogle(java.lang.String, kotlin.jvm.functions.Function2))
Missing class com.google.android.play.core.integrity.StandardIntegrityManager$StandardIntegrityTokenRequest (referenced from: void io.radar.sdk.RadarVerificationManager.fetchTokenFromGoogle(java.lang.String, kotlin.jvm.functions.Function2))
Missing class com.google.android.play.core.integrity.StandardIntegrityManager (referenced from: void io.radar.sdk.RadarVerificationManager.warmUpProviderAndFetchTokenFromGoogle(long, java.lang.String, kotlin.jvm.functions.Function2))
Missing class com.huawei.hmf.tasks.OnFailureListener (referenced from: void io.radar.sdk.RadarHuaweiLocationClient.addGeofences(io.radar.sdk.RadarAbstractLocationClient$RadarAbstractGeofence[], io.radar.sdk.RadarAbstractLocationClient$RadarAbstractGeofenceRequest, android.app.PendingIntent, kotlin.jvm.functions.Function1) and 3 other contexts)
Missing class com.huawei.hmf.tasks.OnSuccessListener (referenced from: void io.radar.sdk.RadarHuaweiLocationClient.addGeofences(io.radar.sdk.RadarAbstractLocationClient$RadarAbstractGeofence[], io.radar.sdk.RadarAbstractLocationClient$RadarAbstractGeofenceRequest, android.app.PendingIntent, kotlin.jvm.functions.Function1) and 2 other contexts)
Missing class com.huawei.hmf.tasks.Task (referenced from: void io.radar.sdk.RadarHuaweiLocationClient.addGeofences(io.radar.sdk.RadarAbstractLocationClient$RadarAbstractGeofence[], io.radar.sdk.RadarAbstractLocationClient$RadarAbstractGeofenceRequest, android.app.PendingIntent, kotlin.jvm.functions.Function1) and 5 other contexts)
Missing class com.huawei.hms.location.FusedLocationProviderClient (referenced from: com.huawei.hms.location.FusedLocationProviderClient io.radar.sdk.RadarHuaweiLocationClient.locationClient and 5 other contexts)
Missing class com.huawei.hms.location.Geofence$Builder (referenced from: void io.radar.sdk.RadarHuaweiLocationClient.addGeofences(io.radar.sdk.RadarAbstractLocationClient$RadarAbstractGeofence[], io.radar.sdk.RadarAbstractLocationClient$RadarAbstractGeofenceRequest, android.app.PendingIntent, kotlin.jvm.functions.Function1))
Missing class com.huawei.hms.location.Geofence (referenced from: void io.radar.sdk.RadarHuaweiLocationClient.addGeofences(io.radar.sdk.RadarAbstractLocationClient$RadarAbstractGeofence[], io.radar.sdk.RadarAbstractLocationClient$RadarAbstractGeofenceRequest, android.app.PendingIntent, kotlin.jvm.functions.Function1))
Missing class com.huawei.hms.location.GeofenceData (referenced from: android.location.Location io.radar.sdk.RadarHuaweiLocationClient.getLocationFromGeofenceIntent(android.content.Intent) and 1 other context)
Missing class com.huawei.hms.location.GeofenceRequest$Builder (referenced from: void io.radar.sdk.RadarHuaweiLocationClient.addGeofences(io.radar.sdk.RadarAbstractLocationClient$RadarAbstractGeofence[], io.radar.sdk.RadarAbstractLocationClient$RadarAbstractGeofenceRequest, android.app.PendingIntent, kotlin.jvm.functions.Function1))
Missing class com.huawei.hms.location.GeofenceRequest (referenced from: void io.radar.sdk.RadarHuaweiLocationClient.addGeofences(io.radar.sdk.RadarAbstractLocationClient$RadarAbstractGeofence[], io.radar.sdk.RadarAbstractLocationClient$RadarAbstractGeofenceRequest, android.app.PendingIntent, kotlin.jvm.functions.Function1))
Missing class com.huawei.hms.location.GeofenceService (referenced from: com.huawei.hms.location.GeofenceService io.radar.sdk.RadarHuaweiLocationClient.geofenceService and 3 other contexts)
Missing class com.huawei.hms.location.LocationCallback (referenced from: void io.radar.sdk.RadarHuaweiLocationClient$getCurrentLocation$1.<init>(io.radar.sdk.RadarHuaweiLocationClient, kotlin.jvm.functions.Function1) and 2 other contexts)
Missing class com.huawei.hms.location.LocationRequest (referenced from: void io.radar.sdk.RadarHuaweiLocationClient.getCurrentLocation(io.radar.sdk.RadarTrackingOptions$RadarTrackingOptionsDesiredAccuracy, kotlin.jvm.functions.Function1) and 1 other context)
Missing class com.huawei.hms.location.LocationResult (referenced from: android.location.Location io.radar.sdk.RadarHuaweiLocationClient.getLocationFromLocationIntent(android.content.Intent))

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:minifyProdReleaseWithR8'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.R8Task$R8Runnable
   > Compilation failed to complete

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 5s
Running Gradle task 'bundleProdRelease'...                          5.9s
Gradle task bundleProdRelease failed with exit code 1

codestronaut avatar Feb 17 '25 15:02 codestronaut

Was not previously an issue when building with 3.12.2.

This appears to be referenced in the android SDK here a couple years ago: https://github.com/radarlabs/radar-sdk-android/issues/313

There is a branch here, also from a couple years ago, that never was merged: https://github.com/radarlabs/radar-sdk-android/tree/fix-missing-huawei-classes

@KennyHuRadar Any update on these fixes?

jt274 avatar Feb 28 '25 18:02 jt274

Proguard rules solved this problem for me.

elias-KTO avatar Mar 07 '25 13:03 elias-KTO

We added these lines to our android/app/proguard-rules.pro

-keep class com.huawei.** { ; } -dontwarn com.huawei.*

SamIAmHarris avatar Apr 01 '25 17:04 SamIAmHarris