I am using Volley and Gson in my project. The project is a Lib project. When I use my Lib in a demo project, the Volley always throw error response with message: "org.json.JSONException: End of input at character 0" and never has success response. I guess it is caused by ProGuard. The weird thing is when I set "minifyEnabled" in either Lib or the Demo project, everything works good. But when I set "minifyEnabled" in both Lib and Demo, volley will always fail. Does anyone now why this happen?
Sorry for missing the content...
this is the error volley throw:
org.json.JSONException: End of input at character 0
and this is my ProGuard for volley and Gson:
## ----------------------------------
## Gson
## ----------------------------------
-keepattributes Signature
-keepattributes *Annotation*
-keep class sun.misc.Unsafe { *; }
-keep class com.google.gson.** { *; }
-keep class com.google.gson.stream.** { *; }
## ----------------------------------
## Glide
## ----------------------------------
-keep class com.bumptech.glide.** {*;}
## -------------------------------------------
## volley
## -------------------------------------------
-keepclassmembers,allowshrinking,allowobfuscation class com.android.volley.NetworkDispatcher {
void processRequest();
}
-keepclassmembers,allowshrinking,allowobfuscation class com.android.volley.CacheDispatcher {
void processRequest();
}
-keep class com.android.volley.** {*;}
-keep class com.android.volley.toolbox.Volley
-keepclassmembers class com.android.volley.toolbox.Volley { *; }
-keep class com.android.volley.toolbox.** {*;}
-keep class com.android.volley.Response$* { *; }
-keep class com.android.volley.Request$* { *; }
-keep class com.android.volley.RequestQueue$* { *; }
-keep class com.android.volley.toolbox.HurlStack$* { *; }
-keep class com.android.volley.toolbox.ImageLoader$* { *; }
-keep class org.apache.http.** {*;}
The important thing is this error only happened if both Lib and Demo are obfuscated at the same time. Obfuscate with either Lib or Demo would not have this issue.
Anyone help? I am 100% sure I keep all my model classes in the ProGuard file.
2019-03-18 14:38:15.635 11276-11276 W/System.err: com.a.a.m: org.json.JSONException: End of input at character 0 of
2019-03-18 14:38:15.635 11276-11276 W/System.err: at com.a.a.a.k.a(Unknown Source:32)
While the com.a.a.a.k is "com.android.volley.toolbox.JsonObjectRequest"