Android Retrofit:发布版和调试版均响应 200,但发布版返回空值 [英] Android Retrofit: Response 200 in both release and debug version but release version have empty value returned

查看:42
本文介绍了Android Retrofit:发布版和调试版均响应 200,但发布版返回空值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是最新的 Retrofit 版本并遵循了 教程 在这里设置我的改造.在我的 Android 应用程序的调试版本中,一切正常.我可以从我在应用程序中拨打的电话中获取数据.但是,当我尝试在我的发行版 apk 中执行相同操作时,响应为 200,但数据为空.我一直在网上寻找解决方案,但找不到任何解决方案.

I am using the latest Retrofit version and followed the tutorial here on setting up my Retrofit. In the debug version of my Android app, everything works perfectly fine. I could get data from the calls I make in the app. However, when I tried to do the same in my release apk, response is 200 but data is null. I've been searching all over the net for the solution but couldn't find any.

推荐答案

所以我决定将 minifyEnabled 设置为 false,令我惊讶的是,它工作正常.我不确定这是否是理想的解决方案,但我也愿意听取其他解决方案.

So I just decided to set minifyEnabled to false and to my surprise, it works fine. I'm not sure if this is an ideal solution but I am willing to hear other solutions as well.

这篇关于Android Retrofit:发布版和调试版均响应 200,但发布版返回空值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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