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

[android] - update proguard config #8944

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion platform/android/MapboxGLAndroidSDK/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ android {
}
}
}

// proguard config for .aar
consumerProguardFiles 'proguard-rules.pro'
}

// avoid naming conflicts, force usage of prefix
Expand Down Expand Up @@ -120,7 +123,6 @@ android {

release {
// aar proguard configuration
consumerProguardFiles 'proguard-rules.pro'
jniDebuggable false
}
}
Expand Down
89 changes: 4 additions & 85 deletions platform/android/MapboxGLAndroidSDK/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -2,89 +2,8 @@
# in ../sdk/tools/proguard/proguard-android.txt,
# contents of this file will be appended into proguard-android.txt
-keepattributes Signature, *Annotation*, EnclosingMethod

# Square okio, ignoring warnings,
# see https://github.com/square/okio/issues/60
-dontwarn okhttp3.**
-dontwarn okio.**

# Gesture package
-keep class almeros.android.multitouch.gesturedetectors.** { *; }

# Package annotations
-keep class com.mapbox.mapboxsdk.annotations.** { *; }

# Package camera
-keep class com.mapbox.mapboxsdk.camera.** { *; }

# Package geometry
-keep class com.mapbox.mapboxsdk.geometry.** { *; }

# Package http
-keep class com.mapbox.mapboxsdk.http.** { *; }

# Package maps
-keep class com.mapbox.mapboxsdk.maps.** { *; }

# Package net
-keep class com.mapbox.mapboxsdk.net.** { *; }

# Package offline
-keep class com.mapbox.mapboxsdk.offline.** { *; }

# Package storage
-keep class com.mapbox.mapboxsdk.storage.** { *; }

# Package style
-keep class com.mapbox.mapboxsdk.style.layers.** { *; }
-keep class com.mapbox.mapboxsdk.style.sources.** { *; }
-keep class com.mapbox.mapboxsdk.style.functions.** { *; }

# Package telemetry
-keep class com.mapbox.mapboxsdk.telemetry.** { *; }

#
# Mapbox-java Proguard rules
# We include these rules since libjava is a Jar file not AAR
#

# Retrofit 2
# Platform calls Class.forName on types which do not exist on Android to determine platform.
-dontnote retrofit2.Platform
# Platform used when running on RoboVM on iOS. Will not be used at runtime.
-dontnote retrofit2.Platform$IOS$MainThreadExecutor
# Platform used when running on Java 8 VMs. Will not be used at runtime.
-dontwarn retrofit2.Platform$Java8
# Retain generic type information for use by reflection by converters and adapters.
-keepattributes Signature
# Retain declared checked exceptions for use by a Proxy instance.
-keepattributes Exceptions

# For using GSON @Expose annotation
-keepattributes *Annotation*
# Gson specific classes
-dontwarn sun.misc.**

# Prevent proguard from stripping interface information from TypeAdapterFactory,
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer

# MAS Data Models
-keep class com.mapbox.services.commons.geojson.** { *; }
-keep class com.mapbox.services.mapmatching.v4.models.** { *; }
-keep class com.mapbox.services.distance.v1.models.** { *; }
-keep class com.mapbox.services.directions.v4.models.** { *; }
-keep class com.mapbox.services.directions.v5.models.** { *; }
-keep class com.mapbox.services.geocoding.v5.models.** { *; }

-dontwarn javax.annotation.**

-keepclassmembers class rx.internal.util.unsafe.** {
long producerIndex;
long consumerIndex;
}

-keep class com.google.** { *; }
-dontwarn com.google.**
-keep class com.mapbox.mapboxsdk.** { *; }
-keep interface com.mapbox.mapboxsdk.** { *; }
-keep class com.mapbox.services.android.telemetry.** { *; }
-keep class com.mapbox.services.commons.** { *;}
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
-dontwarn org.codehaus.**
-keep class com.google.**
-dontwarn com.google.**
-dontwarn java.nio.**

-keep class com.mapbox.mapboxsdk.testapp.model.customlayer.ExampleCustomLayer { *; }
2 changes: 1 addition & 1 deletion platform/android/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ ext {

// square crew
timber : 'com.jakewharton.timber:timber:4.5.1',
okhttp3 : 'com.squareup.okhttp3:okhttp:3.6.0',
okhttp3 : 'com.squareup.okhttp3:okhttp:3.7.0',
leakCanaryDebug : "com.squareup.leakcanary:leakcanary-android:${leakCanaryVersion}",
leakCanaryRelease : "com.squareup.leakcanary:leakcanary-android-no-op:${leakCanaryVersion}",
leakCanaryTest : "com.squareup.leakcanary:leakcanary-android-no-op:${leakCanaryVersion}"
Expand Down