Skip to content

Commit

Permalink
fix: key "batch" was being obfuscated due to proguard (#423)
Browse files Browse the repository at this point in the history
fix: "batch" was being obfuscated due to proguard.
Mentioned the serialized name as annotation.
As a safeguard also added the file to proguard rules
  • Loading branch information
itsdebs authored May 20, 2024
1 parent 6bce2a9 commit eaa282c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 22 deletions.
1 change: 1 addition & 0 deletions core/proguard-consumer-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
-keep class com.rudderstack.android.sdk.core.persistence.DefaultPersistenceProviderFactory { *; }

# Required for Device Mode Transformations
-keep class com.rudderstack.android.sdk.core.TransformationRequest { *; }
-keep class com.rudderstack.android.sdk.core.TransformationResponse { *; }
-keep class com.rudderstack.android.sdk.core.TransformationResponseDeserializer { *; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
import java.util.List;

public class TransformationRequest {
@SerializedName(value="batch")
final List<TransformationRequestEvent> batch;

public TransformationRequest(List<TransformationRequestEvent> batch) {
TransformationRequest(List<TransformationRequestEvent> batch) {
this.batch = batch;
}

Expand Down
1 change: 1 addition & 0 deletions sample-kotlin/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
android.enableR8.fullMode=true
21 changes: 0 additions & 21 deletions sample-kotlin/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@

# These rules should be kept as part of the reporter module, as the fields of Entities are getting removed
# this deals with `There should be at least one field in @Entity`
-keep class com.rudderstack.android.ruddermetricsreporterandroid.models.LabelEntity { *; }
-keep class com.rudderstack.android.ruddermetricsreporterandroid.models.MetricEntity { *; }
-keep class com.rudderstack.android.ruddermetricsreporterandroid.models.ErrorEntity { *; }

# Required for the usage off TypeToken class in Utils.converToMap, Utils.convertToList
-keep class com.google.gson.reflect.TypeToken { *; }
Expand All @@ -34,31 +31,13 @@
-keep class com.google.gson.internal.LinkedTreeMap { *; }
-keep class * implements java.io.Serializable { *; }

-keep class com.rudderstack.rudderjsonadapter.RudderTypeAdapter { *; }
-keep class * extends com.rudderstack.rudderjsonadapter.RudderTypeAdapter

# Required to ensure the DefaultPersistenceProviderFactory is not removed by Proguard and works as expected
# even when the customer is not using encryption feature.
-dontwarn net.sqlcipher.Cursor
-dontwarn net.sqlcipher.database.SQLiteDatabase$CursorFactory
-dontwarn net.sqlcipher.database.SQLiteDatabase
-dontwarn net.sqlcipher.database.SQLiteOpenHelper
-keep class com.rudderstack.android.sdk.core.persistence.DefaultPersistenceProviderFactory { *; }

# Required for the usage of annotations across reporter and web modules
-dontwarn com.fasterxml.jackson.annotation.JsonIgnore
-dontwarn com.squareup.moshi.Json
-dontwarn com.fasterxml.jackson.annotation.JsonProperty

# because of an issue with the dependencies used by the instruementation tests as mentioned here
# androidTestImplementation 'androidx.test.ext:junit:1.1.5'
# androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
# the errors didn't go even after adding the below rule, hence needed to remove the instrumentation tests for the time being.
-dontwarn com.google.errorprone.annotations

# Required for Amplitude Device Mode
-keep class com.rudderstack.android.integrations.amplitude.AmplitudeDestinationConfig { *; }

# Required for DMT
-keep class com.rudderstack.android.sdk.core.TransformationResponse { *; }
-keep class com.rudderstack.android.sdk.core.TransformationResponseDeserializer { *; }

0 comments on commit eaa282c

Please sign in to comment.