Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrofit 2 returns null in release APK when minifyenable but ok in debug APK

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

enter image description here

But Getting expected response with debug APK when minify enable.

like image 352
Jahangir Kabir Avatar asked Mar 14 '17 09:03

Jahangir Kabir


4 Answers

Problem solved :)

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

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

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

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

like image 59
Jahangir Kabir Avatar answered Nov 04 '22 10:11

Jahangir Kabir


I had the same problem and my solution was to modify the 'protection rules' to exclude your class from obfuscation.

-keep public class com.your.packages.model.** {*;}
like image 40
Juanes30 Avatar answered Nov 04 '22 09:11

Juanes30


-keep public class com.your.packages.model.* {*;}

Worked for me

like image 29
Shubham Goel Avatar answered Nov 04 '22 10:11

Shubham Goel


You need to setup proguard-rule for release. If you want to test real server, you can create new build type, which targets server API

Cheers :)

like image 1
Milovan Jovic Avatar answered Nov 04 '22 10:11

Milovan Jovic