最小化后,Retrofit 2在发布APK中返回null,但在调试APK中可以 [英] Retrofit 2 returns null in release APK when minifyenable but ok in debug APK

查看:114
本文介绍了最小化后,Retrofit 2在发布APK中返回null,但在调试APK中可以的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

获得空响应,但最小启用时代码200,带有Release APK,最小时为false,然后确定.

Getting null response but code 200 with Release APK when minify enable, when minify false then its ok.

但是启用最小化功能时,通过调试APK即可获得预期的响应.

But Getting expected response with debug APK when minify enable.

推荐答案

问题已解决:)

proguard规则没有问题,无需添加任何其他内容.

No issue with proguard-rules no need to add anything extra.

即使变量名称与键相同,如果minifyEnabled也需要添加SerializedName批注.

Needed to add SerializedName annotation if minifyEnabled even if variable name same as key.

那是我手动创建的唯一模型:P

That was the only Model which i had created manually :P

哪些可以在Debug中正常运行,但登录后不能正常运行.:)

Which works fine in Debug but not after Signed in. :)

这篇关于最小化后,Retrofit 2在发布APK中返回null,但在调试APK中可以的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆