Something went wrong while trying to deserialize a response from the server
Tolansoft opened this issue · 10 comments
When testing app from Google Play console internal test channel with release build with ;
minifyEnabled true
shrinkResources true
"Something went wrong while trying to deserialize a response from the server" error occurs on Model answer
There is no Logcat info on Android Studio when it occurs.
What i tried is : Added lines below to my proguard-rules.pro
-keep class androidx.compose.ui.*.*{*;} -keep class com.google.ai.*.*{*;}
but not works
Thank you!
Hi @Tolansoft thanks for your report. Is this an error you are seeing consistently across different executions and using different prompts? or is it restricted to some use cases?
@emilypgoogle could you please take a look? Thanks!
Will do
I believe this is an issue of misconfigured proguard rules, a large amount of our internal classes are obfuscated with the rules you've posted. Several internal types rely on automatic serialization based on symbol names, so you'll need to not obfuscate them. Try -keep class com.google.ai.** {*;}
or similar. For more testing with proguard exclusions, you can use https://playground.proguard.com/
Hey @Tolansoft PR #23 fixes the issue by shipping the right proguard.txt
as part of the SDK. This will be part of the next release. In the meanwhile, following @emilypgoogle advice on the comment above is a viable workaround. Once again, thanks for your report!
Hey Rodrigo and Emily and thanks for fixing it!
It will be better if you add the -keep class com.google.ai.** {*;}
rule in the readme, Thank you!
@davidmotson I see you're working on serialization in your branch, I still see this serialization error response even though the first flow emission is of a valid response.
looks like it's having a hard time parsing out the following response (no surprise - I wouldn't expect this invalid json either),
data: {"candidates": [{"content": {"parts": [{"text": " This is a photo of a group of people who work together. They are posing in front of a mural of a forest."}],"role": "model"},"finishReason": "STOP","index": 0,"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}]}],"promptFeedback": {"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}]}}
{
"error": {
"code": 500,
"message": "An internal error has occurred. Please retry or report in.
https://developers.generativeai.google/guide/troubleshooting",
"status": "INTERNAL"
}
}