1

When I generate a signed apk, my facebook and linkedin key hashes are invalid, but if I run directly from my machines it's working. How can I resolve this?

I also added key hashes that were required, but did not get any solution.

I already refered to the following links :

Release apk Facebook hash key not same with generated one

android facebook integration invalid key hash

Everything works fine when I run apk with usb directly, but I have problems with generating a signed apk.

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
Jatin Devani
  • 41
  • 1
  • 7

1 Answers1

0

Hi Put this code in any reachable activity's onCreate method to print the hash key in the console and update that hash key in your facebook linked account with the application, replace "com.facebook.samples.loginhowto" with your package name and update in that key in facebook developer console-> your app settings and copy paste the keys including "="

try {
            PackageInfo info = getPackageManager().getPackageInfo(
                    "com.facebook.samples.loginhowto", 
                    PackageManager.GET_SIGNATURES);
            for (Signature signature : info.signatures) {
                MessageDigest md = MessageDigest.getInstance("SHA");
                md.update(signature.toByteArray());
                Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
                }
        } catch (NameNotFoundException e) {

        } catch (NoSuchAlgorithmException e) {

        }

For reference check my answer on this post. Android Facebook Integration Invalid Key hash error on Android device but working fine on Emulator

Rishabh Saxena
  • 1,765
  • 15
  • 26