Signed APK Crash when Downloaded from Google Play Store [duplicate]

Question!

I am using Facebook SDK for Login with Facebook in my application, app works perfectly when I use unsigned APK or install signed APK in my real device. But when I upload same signed APK on Play Store and download and run it crash with below error log.

I have already tried to add below code in my progaurd-project.txt file.

-keep class com.facebook.** {
   *;
}

My project.property file is:

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=Google Inc.:Google APIs:22
android.library.reference.1=..\\google-play-services_lib
android.library.reference.2=..\\CircularImageViewLib
android.library.reference.3=..\\VKOpenAuthActivitySDK
android.library.reference.4=..\\android-support-v7-appcompat
android.library.reference.5=..\\FourSquareLib
android.library.reference.6=..\\..\\..\\git\\StickyScrollViewItems\\library
android.library.reference.7=..\\Cropper
android.library.reference.8=..\\FacebookSDK\\FacebookSDK
android.library.reference.9=..\\LDrawerLib
android.library.reference.10=../LinkedinSDK

My proguard-project.txt is:

# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}

-keep class com.facebook.** {
   *;
}

Error log is:

com.facebook.an: com.facebook.b.f got an unexpected method signature: public abstract org.json.JSONObject com.facebook.b.c.c()
at com.facebook.b.h.a(Unknown Source)
at com.facebook.b.f.b(Unknown Source)
at com.facebook.b.f.invoke(Unknown Source)
at java.lang.reflect.Proxy.invoke(Proxy.java:397)
at $Proxy0.c(Unknown Source)
at com.facebook.internal.cj.a(Unknown Source)
at com.facebook.internal.cj.onPostExecute(Unknown Source)
at android.os.AsyncTask.finish(AsyncTask.java:632)
at android.os.AsyncTask.access$600(AsyncTask.java:177)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5944)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1389)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1184)

I have already checked my released Keyhash and added that on Facebook too.

Solutions that are already been tried:

  1. Signed apk crashes with facebook login

  2. Android Facebook integration with proguard

  3. Facebook and proguard

  4. Android ProGuard settings for Facebook

  5. Error on exported apk - FacebookSDK

  6. I got this error for first attempt to login facebook.How can solve this?



Answers

Change in your proguard-project.txt file according below :

-keepattributes Signature
-keep class com.facebook.model.** { *; }

-keepnames class * implements java.io.Serializable
-keepclassmembers class * implements java.io.Serializable {
    static final long serialVersionUID;
    private static final java.io.ObjectStreamField[] serialPersistentFields;
    !static !transient 


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