rnmapbox / rnmapbox/maps

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

Open
#3,344 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug 🪲 waiting wontfix-valid
Dominant language
Kotlin
Stars
2.9k
Forks
947
Avg merge
6d 37m
Merged PRs (30d)
1

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the release build with expo run:android --variant release and inspect the :app:minifyReleaseWithR8 failure. Review the generated android/app/build/outputs/mapping/release/missing_rules.txt and the listed missing Google Play Services and Mapbox-related classes. Done means the Expo SDK 50 production build completes successfully with pro guard enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin, react-native
Domain
build-system, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.