android - Empty json data in Release build (using proguard) -



android - Empty json data in Release build (using proguard) -

my app doesn't post info server when run release version (signed, proguard packed). if run straight adt, see info on server.

it's weird because same code, 1 signed , other direct execution. here code (using org.springframework.web.client.resttemplate):

private static string url = "https://myappserver.com/abcservice/"; public responseentity<string> sendmessage(usermessage us) { private resttemplate template = gettemplate(); httpentity<usermessage> reqentity = new httpentity<usermessage>(us, headers); responseentity<string> result = template.postforentity(url, reqentity, string.class); homecoming result; }

below 2 scenarios:

case 1: works good

run app straight adt (run as: android application) user taps button, invoke sendmessage(..) method. controller (on server) gets request , info (usermessage). an entry usermessage created. server send 201 response (request has been fulfilled), app.

case 2: problem

pack app (android tools -> export signed application package..) install on device through command line (adb install xxx.apk) start app. user taps button, invoke sendmessage(..) method. controller (on server) gets request but no data. an entry empty usermessage created. server send 201 response (request has been fulfilled), app.

i have tried log both on device , web server, can confirm empty info received case 2, , i'm not able figure out why doesn't send info when pack it?

does packed/released (signed +proguard) apps behave differently, compared debug packaging?

i guess caused proguard. proguard obfuscating portion of code, code dynamically invoked spring (and jackson ? didn't mention it). (and 1 time obfuscate : dynamic invocation failed)

so seek :

disable proguard confirm cause of problem

if confirmed : seek configure hat won't obfuscate class serialized in json (i.e. usermessage) :

-keep class com.company.usermessage** { *; }

android json adt proguard spring-android

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -