Skip to content

Commit 8bc4612

Browse files
committed
Added Logging and proguard rules to avoid parsing errors on build
1 parent 27e90a8 commit 8bc4612

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

app/proguard-rules.pro

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,17 @@
2727

2828
# Keep inference helper
2929
-keep class org.openinsectid.app.utils.InferenceManager { *; }
30+
31+
32+
# Gson rules for AlphaResponse
33+
-keep class org.openinsectid.app.data.AlphaResponse { *; }
34+
-keep class org.openinsectid.app.data.AlphaInnerResponse { *; }
35+
-keepclassmembers class org.openinsectid.app.data.* {
36+
<fields>;
37+
}
38+
39+
# Gson general rules
40+
-keepattributes Signature
41+
-keepattributes *Annotation*
42+
-dontwarn sun.misc.**
43+
-keep class com.google.gson.** { *; }

app/src/main/java/org/openinsectid/app/ui/components/AlphaLLMAnswerBox.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,12 @@ private fun parseAlphaResponse(raw: String): String {
7979
} else {
8080
"Error: $raw"
8181
}
82-
} catch (_: JsonSyntaxException) {
82+
} catch (e: JsonSyntaxException) {
83+
Log.e("AlphaLLM","$e: ${e.message}; $raw")
8384
// Fallback to raw text if JSON parsing fails
8485
raw
85-
} catch (_: Exception) {
86+
} catch (e: Exception) {
87+
Log.e("AlphaLLM","$e: ${e.message}; $raw")
8688
raw
8789
}
8890
}

0 commit comments

Comments
 (0)