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

Proguard and adding a GeoJson source #9569

Closed
cammace opened this issue Jul 20, 2017 · 2 comments
Closed

Proguard and adding a GeoJson source #9569

cammace opened this issue Jul 20, 2017 · 2 comments
Assignees
Labels
Android Mapbox Maps SDK for Android

Comments

@cammace
Copy link
Contributor

cammace commented Jul 20, 2017

Enabling Proguard in an android app and trying to create a GeoJson source will result in an app crash with this log:

07-20 14:58:22.380 9325-9325/com.mapbox.services.android.testapp E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                   Process: com.mapbox.services.android.testapp, PID: 9325
                                                                                   java.lang.NoSuchMethodError: no non-static method "Lcom/google/gson/JsonObject;.entrySet()Ljava/util/Set;"
                                                                                       at com.mapbox.mapboxsdk.style.sources.GeoJsonSource.nativeSetFeatureCollection(Native Method)
                                                                                       at com.mapbox.mapboxsdk.style.sources.GeoJsonSource.setGeoJson(Unknown Source:0)
                                                                                       at com.mapbox.mapboxsdk.style.sources.GeoJsonSource.<init>(Unknown Source:7)
                                                                                       at com.mapbox.services.android.testapp.optimizedtrip.OptimizedTripActivity.a(Unknown Source:23)
                                                                                       at com.mapbox.services.android.testapp.optimizedtrip.OptimizedTripActivity.a(Unknown Source:0)
                                                                                       at com.mapbox.services.android.testapp.optimizedtrip.OptimizedTripActivity$1.a(Unknown Source:45)
                                                                                       at d.g$a$1$1.run(Unknown Source:41)
                                                                                       at android.os.Handler.handleCallback(Handler.java:769)
                                                                                       at android.os.Handler.dispatchMessage(Handler.java:98)
                                                                                       at android.os.Looper.loop(Looper.java:164)
                                                                                       at android.app.ActivityThread.main(ActivityThread.java:6541)
                                                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                                                       at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
                                                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

Code being used:

GeoJsonSource source = new GeoJsonSource(LINE_SOURCE, featureCollection);
    mapboxMap.addSource(source);

    LineLayer layer = new LineLayer(LINE_LAYER, LINE_SOURCE).withProperties(
      PropertyFactory.lineWidth(5f),
      PropertyFactory.lineColor(Color.parseColor("#009DF9"))
    );

    mapboxMap.addLayerBelow(layer, "poi-parks-scalerank2");

cc: @tobrun @Guardiola31337

@cammace cammace added the Android Mapbox Maps SDK for Android label Jul 20, 2017
@tobrun
Copy link
Member

tobrun commented Jul 20, 2017

Seems that we need to include proguard rules for gson, don't see this as a blocker for a 5.1.1 release (end users can include this themselves in meantime). Adding to 5.2.0 milestone.

@Guardiola31337
Copy link
Contributor

I run into the same issue in mapbox/mapbox-android-demo#396 and I fixed it adding -keep class com.google.** { *; }

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

3 participants