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

Commit

Permalink
make gson retro compatible with older versions of AGP (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
marandaneto authored Dec 1, 2019
1 parent 4cf2bc0 commit d56d805
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
5 changes: 3 additions & 2 deletions buildSrc/src/main/java/Config.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
object Config {
val kotlinVersion = "1.3.60"
val kotlinVersion = "1.3.61"
val kotlinStdLib = "stdlib-jdk8"

object BuildPlugins {
Expand All @@ -20,7 +20,8 @@ object Config {
object Libs {
val appCompat = "androidx.appcompat:appcompat:1.1.0"
val timber = "com.jakewharton.timber:timber:4.7.1"
val gson = "com.google.code.gson:gson:2.8.6"
// only bump gson if https://github.com/google/gson/issues/1597 is fixed
val gson = "com.google.code.gson:gson:2.8.5"
val leakCanary = "com.squareup.leakcanary:leakcanary-android:2.0-beta-4"
}

Expand Down
7 changes: 6 additions & 1 deletion sentry-android-core/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Gson specific classes
-dontwarn sun.misc.**
-keep class com.google.gson.** { *; }
#-keep class com.google.gson.stream.** { *; }
-keep class sun.misc.Unsafe { *; }

# Application classes that will be serialized/deserialized over Gson
-keep class io.sentry.core.** { *; }
Expand All @@ -30,4 +30,9 @@
@com.google.gson.annotations.SerializedName <fields>;
}

# Keep jetbrains annotations
-keep @interface com.jakewharton.nopen.annotation.** { *; }
-keep @interface org.jetbrains.annotations.** { *; }


##---------------End: proguard configuration for Gson ----------
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ public void write(final JsonWriter out, final T value) throws IOException {
public T read(final JsonReader in) {
// In its simplest solution, we can just collect a JSON tree because its much easier to
// process
JsonElement jsonElement = JsonParser.parseReader(in);
JsonParser parser = new JsonParser();
JsonElement jsonElement = parser.parse(in);

if (jsonElement == null || jsonElement.isJsonNull()) {
return null;
Expand Down

0 comments on commit d56d805

Please sign in to comment.