我正在使用Retrofit2,并且在启用了proguard的发布模式下运行应用程序时,我无法发送发布请求正文:
我得到了这个日志:
D/OkHttp: --> POST http:url
Content-Type: application/json
Content-Length: 0
--> END POST (0-byte body)
但是如果我在没有proguard的调试模式下运行该应用程序,则POST请求可以正常工作!
我添加了Proguard的改装规则:
# Platform calls Class.forName on types which do not exist on Android to determine platform.
-dontnote retrofit2.Platform
# Platform used when running on Java 8 VMs. Will not be used at runtime.
-dontwarn retrofit2.Platform$Java8
# Retain generic type information for use by reflection by converters and adapters.
-keepattributes Signature
# Retain declared checked exceptions for use by a Proxy instance.
-keepattributes Exceptions
-dontwarn okio.**
另外,我正在使用原始Json并使用lib:
com.squareup.retrofit2:converter-scalars:2.3.0
知道这是怎么发生的吗?