android-async-http: in Release app (proguard config open),PersistentCookieStore can't get stored cookies,

in Release app (proguard config open),PersistentCookieStore can’t get stored cookies,…

PersistentCookieStore defaultStore = new PersistentCookieStore(BaseApplication.getContext());
client.setCookieStore(defaultStore);

in PersistentCookieStore.java:

protected Cookie decodeCookie(String cookieString) {
byte[] bytes = hexStringToByteArray(cookieString);
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
Cookie cookie = null;
try {
    ObjectInputStream objectInputStream = new ObjectInputStream(byteArrayInputStream);
    cookie = ((SerializableCookie) objectInputStream.readObject()).getCookie();
    Utils.showToast("decode cookie complete!");

} catch (Exception e) {

}
return cookie;
}

if I enable the proguard config, decodeCookie always return null; and If disable pro guard config,everything is ok

how can I modify the proguard-project.txt??

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

Hi @smarek, I’ve encountered a similar (possibly same) problem when using ProGuard for first time with my app, and just came across this thread. Borrowing some clues from @luotao001’s post, I got things to work by adding the following lines to my proguard-rules.pro file:

-keep class com.loopj.android.** { *; }
-keep interface com.loopj.android.** { *; }

Cheers!