0

I have integrated face book and Google plus login its working fine. But this functionality is not working in Signed apk.

  • 3
    Possible duplicate of [Google sign in signed apk not working](https://stackoverflow.com/questions/36045652/google-sign-in-signed-apk-not-working) – AskNilesh Mar 09 '18 at 09:11
  • https://stackoverflow.com/questions/27272403/facebook-and-google-login-is-not-working-in-android-in-signed-apk – AskNilesh Mar 09 '18 at 09:12

1 Answers1

0

Choose "Build Variants" in bottom left side of AndroidStudio,change build variant into "release".

Add this to your MainActivity

 try {
            PackageInfo info = getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_SIGNATURES);
            for (Signature signature : info.signatures) {
                MessageDigest md = MessageDigest.getInstance("SHA");
                md.update(signature.toByteArray());
                String hashKey = new String(Base64.encode(md.digest(), 0));
                Log.i(TAG, "printHashKey() Hash Key: " + hashKey);
            }
        } catch (NoSuchAlgorithmException e) {
            Log.e(TAG, "printHashKey()", e);
        } catch (Exception e) {
            Log.e(TAG, "printHashKey()", e);
        }

After getting Hash Key remove above code and add it to facebook and google+ developer accounts where key hashes are added.

Levon Petrosyan
  • 8,815
  • 8
  • 54
  • 65