parse.com not working after proguard

Question!

I'm using Parse.com features in my app, everything works great on debugging mode. As soon as I generate a signed apk in release mode, I have a killing wait sometimes up to 10 seconds at the beginning of opening my app. most probably it's because of Parse.com trying to initialize and contact its servers, which apparently is not successful.

And also, parse.com stops working I know so, since no data would be uploaded into my account.

There should be a problem with Proguard of course since the only difference between debug and release mode, is enabling proguard, in my case.

I have also triend to keep com.parse with following code in my proguard rules:

 #keep parse classes
-keepattributes Annotation,SourceFile,LineNumberTable
-dontwarn com.parse.**
-keep class com.parse.* { *; }
-keep class com.parse.** { *; }

any help would be appreciated!

EDIT:

I found out that a huge memory leak is happening at the Parse.initialize() after the Proguard ... still have no idea why though! Of course this memory leak is not present while proguard is off enter image description here



Answers

for com.fasterxml.jackson add below -keep class com.fasterxml.jackson.databind. ObjectMapper { public ; protected ; } -keep class com.fasterxml.jackson.databind. ObjectWriter { public ** writeValueAsString(**); }



Apparently the problem is some ANR in the Parse.com library, precisely when it tries to read its cash to sync previous unsynced data or something like this.

enter image description here

this happens due to the optimization, since with

-dontoptimize

parameter in proguard settings the problem is solved, although this is not a good idea, I think, and there should be a way to stop proguard from optimizing just this library.Although all I could find was this parameters :

# keep parse classes
#-dontwarn com.parse.**
-keep class com.parse.** { *; }
-keep interface com.parse.** { *; }

#-dontwarn org.apache.**
-keep class org.apache.** { *; }
-keep interface org.apache.** { *; }

#-dontwarn com.squareup.**
-keep class com.squareup.** { *; }
-keep interface com.squareup.** { *; }

-keep class com.shygunsys.pocketcyber.techicalservices.parse.**



-keep class com.fasterxml.jackson.databind.ObjectMapper {
    public 


Try the following if you have Apache http-core and http-mime along with Parse library:

-keep class org.apache.** { *; }
-keep class com.parse.** { *; }

-dontwarn com.parse.**
-dontwarn org.apache.**
-dontwarn com.squareup.**
By : iSun


This video can help you solving your question :)
By: admin