Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Missing ProGuard rule for AutoValue #12919

Closed
jrgonzalezg opened this issue Sep 19, 2018 · 1 comment
Closed

Missing ProGuard rule for AutoValue #12919

jrgonzalezg opened this issue Sep 19, 2018 · 1 comment
Labels
Android Mapbox Maps SDK for Android

Comments

@jrgonzalezg
Copy link

Steps to reproduce

  1. Add com.mapbox.mapboxsdk:mapbox-android-sdk:6.5.0 dependency to an Android project.
  2. Build a release version of the app with ProGuard turned on.

Expected behavior

App compiles and APKs are generated.

Actual behavior

Build fails in ProGuard due to a transitive dependency on AutoValue that is missing on the consumer ProGuard rules leading to the following warnings that stop the build:

Warning: com.mapbox.geojson.BoundingBox: can't find referenced class com.google.auto.value.AutoValue
Warning: com.mapbox.geojson.Feature: can't find referenced class com.google.auto.value.AutoValue
Warning: com.mapbox.geojson.FeatureCollection: can't find referenced class com.google.auto.value.AutoValue
Warning: com.mapbox.geojson.GeometryCollection: can't find referenced class com.google.auto.value.AutoValue
Warning: com.mapbox.geojson.LineString: can't find referenced class com.google.auto.value.AutoValue
Warning: com.mapbox.geojson.MultiLineString: can't find referenced class com.google.auto.value.AutoValue
Warning: com.mapbox.geojson.MultiPoint: can't find referenced class com.google.auto.value.AutoValue
Warning: com.mapbox.geojson.MultiPolygon: can't find referenced class com.google.auto.value.AutoValue
Warning: com.mapbox.geojson.Point: can't find referenced class com.google.auto.value.AutoValue
Warning: com.mapbox.geojson.Polygon: can't find referenced class com.google.auto.value.AutoValue
Warning: com.mapbox.turf.models.LineIntersectsResult: can't find referenced class com.google.auto.value.AutoValue
Warning: com.mapbox.turf.models.LineIntersectsResult$Builder: can't find referenced class com.google.auto.value.AutoValue$Builder
Warning: com.mapbox.turf.models.LineIntersectsResult$Builder: can't find referenced class com.google.auto.value.AutoValue
Warning: com.mapbox.turf.models.LineIntersectsResult$Builder: can't find referenced class com.google.auto.value.AutoValue$Builder

This can be fixed by adding the related rule that is present on demos (https://github.com/mapbox/mapbox-android-demo/blob/master/MapboxAndroidDemo/proguard-rules.pro):

# --- AutoValue ---
# AutoValue annotations are retained but dependency is compileOnly.
-dontwarn com.google.auto.value.**

This should be added to the consumer ProGuard rules instead so apps depending on the Mapbox SDK do not need to manually add it even if they are not using AutoValue.

Configuration

Android versions: N/A
Device models: N/A
Mapbox SDK versions: 6.5.0

@tobrun tobrun added the Android Mapbox Maps SDK for Android label Sep 19, 2018
@tobrun tobrun added this to the android-v6.6.0 milestone Sep 19, 2018
@tobrun
Copy link
Member

tobrun commented Sep 19, 2018

Thank you for the report, this went unnoticed in our test application due to:

-dontwarn com.google.**

Will fix this up!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

No branches or pull requests

2 participants