rnmapbox / maps

A Mapbox react native module for creating custom maps
MIT License
2.27k stars 849 forks source link

[Bug]: Missing classes when pro guard enabled with Expo SDK 50 #3344

Open raajnadar opened 9 months ago

raajnadar commented 9 months ago

Mapbox Implementation

Mapbox

Mapbox Version

11

Platform

Android

@rnmapbox/maps version

10.1.8

Standalone component to reproduce

import React from 'react';
import {
  MapView,
  ShapeSource,
  LineLayer,
  Camera,
} from '@rnmapbox/maps';

const aLine = {
  type: 'LineString',
  coordinates: [
    [-74.00597, 40.71427],
    [-74.00697, 40.71527],
  ],
};

class BugReportExample extends React.Component {
  render() {
    return (
      <MapView style={{flex: 1}}>
        <Camera centerCoordinate={[-74.00597, 40.71427]} zoomLevel={14} />
        <ShapeSource id="idStreetLayer" shape={aLine}>
          <LineLayer id="idStreetLayer" />
        </ShapeSource>
      </MapView>
    );
  }
}

Observed behavior and steps to reproduce

The error is on build for production with pro guard enabled

Run

expo run:android --variant release

Expected behavior

There should not a build errors

Notes / preliminary analysis

There is no issue on dev mode There is no issue in Expo SDK 49

Additional links and references

> Task :app:minifyReleaseWithR8 FAILED
ERROR: Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in /Users/<project-path>/android/app/build/outputs/mapping/release/missing_rules.txt.
ERROR: R8: Missing class com.google.android.gms.location.ActivityRecognition (referenced from: void com.mapbox.common.movement.ProxyGoogleActivityRecognitionClient.<init>(android.content.Context))
Missing class com.google.android.gms.location.ActivityRecognitionClient (referenced from: void com.mapbox.common.movement.ProxyGoogleActivityRecognitionClient.<init>(android.content.Context))
Missing class com.google.android.gms.location.ActivityRecognitionResult (referenced from: com.mapbox.common.MovementInfo com.mapbox.common.movement.GoogleActivityRecognition$Companion.toMovementInfo(com.google.android.gms.location.ActivityRecognitionResult, com.mapbox.common.MovementModeProvider) and 2 other contexts)
Missing class com.google.android.gms.location.ActivityTransition$Builder (referenced from: java.util.List com.mapbox.common.movement.GoogleActivityRecognition$Companion$TRANSITION_API_MONITORING_TYPES$2.invoke())
Missing class com.google.android.gms.location.ActivityTransition (referenced from: java.util.List com.mapbox.common.movement.GoogleActivityRecognition$Companion$TRANSITION_API_MONITORING_TYPES$2.invoke())
Missing class com.google.android.gms.location.ActivityTransitionEvent (referenced from: com.mapbox.common.MovementInfo com.mapbox.common.movement.GoogleActivityRecognition$Companion.toMovementInfo(com.google.android.gms.location.ActivityTransitionResult, com.mapbox.common.MovementModeProvider))
Missing class com.google.android.gms.location.ActivityTransitionRequest (referenced from: void com.mapbox.common.movement.GoogleActivityRecognition.start() and 2 other contexts)
Missing class com.google.android.gms.location.ActivityTransitionResult (referenced from: com.mapbox.common.MovementInfo com.mapbox.common.movement.GoogleActivityRecognition$Companion.toMovementInfo(com.google.android.gms.location.ActivityTransitionResult, com.mapbox.common.MovementModeProvider) and 2 other contexts)
Missing class com.google.android.gms.location.DetectedActivity (referenced from: com.mapbox.common.MovementInfo com.mapbox.common.movement.GoogleActivityRecognition$Companion.toMovementInfo(com.google.android.gms.location.ActivityRecognitionResult, com.mapbox.common.MovementModeProvider))
Missing class com.google.android.gms.location.FusedLocationProviderClient (referenced from: void com.mapbox.common.location.ProxyGoogleFusedLocationProviderClient.<init>(android.content.Context))
Missing class com.google.android.gms.location.LocationCallback (referenced from: void com.mapbox.common.location.GoogleDeviceLocationProvider$locationCallback$1.<init>(com.mapbox.common.location.GoogleDeviceLocationProvider) and 6 other contexts)
Missing class com.google.android.gms.location.LocationRequest (referenced from: void com.mapbox.common.location.GoogleDeviceLocationProvider.doStart() and 5 other contexts)
Missing class com.google.android.gms.location.LocationResult (referenced from: void com.mapbox.common.location.GoogleDeviceLocationProvider$locationCallback$1.onLocationResult(com.google.android.gms.location.LocationResult) and 1 other context)
Missing class com.google.android.gms.location.LocationServices (referenced from: void com.mapbox.common.location.ProxyGoogleFusedLocationProviderClient.<init>(android.content.Context))
Missing class com.tobrun.datacompat.annotation.Default (referenced from: void com.mapbox.maps.plugin.attribution.generated.AttributionSettingsData.<init>(boolean, int, int, float, float, float, float, boolean) and 11 other contexts)

FAILURE: Build failed with an exception.

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

Please include actual errors. Also you can disable pro guard as a workaround.

raajnadar commented 9 months ago

@mfazekas I added the error in the main issue thread at the end, please check and let me know if you need any other information.

mfazekas commented 9 months ago

See https://github.com/mapbox/mapbox-maps-android/issues/2265

raajnadar commented 9 months ago

@mfazekas could you please guide me what will be the next step? I have very little knowledge of this pro-guard stuff

mfazekas commented 9 months ago

@raajnadar I'm sorry, I'm not planning to do anything about it.

https://github.com/rnmapbox/maps/wiki/Support