Invalid key hash. The key hash 8392849ZvfdjHakw2849H245738wue0 does not match any stored key hashes. Configure your app key hashes at http://developers.facebook.com/apps/ APP-ID
If you are getting the above error message while trying to log in to an App using Facebook App then the reason is that your key hash is not correct, just regenerate it and update it on the App's Developers console.
To get the Key Hash all you need to do is just need to copy the below code in onCreate() method of your launch Activity Class and watch the output in Android Studio LogCat,
FbKeyHashSnippet.javatry {
PackageInfo info = getPackageManager().getPackageInfo(
"com.your-package-name",
PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.d("YourKeyHash :", Base64.encodeToString(md.digest(), Base64.DEFAULT));
System.out.Println("YourKeyHash: ", Base64.encodeToString(md.digest(), Base64.DEFAULT));
}
} catch (NameNotFoundException e) {
} catch (NoSuchAlgorithmException e) {
}
Note: Just replace com.your-package-name with your app package name in the above code.
More Posts related to Android,
- Check Internet Connection WIFI 4G is active on Android Programmatically
- Android Emulator cannot be opened because the developer cannot be verified. [M1 Mac]
- How to Change Android Toast Position?
- Fail to connect to camera service Android java RuntimeException
- How to create Custom RatingBar Android Programming Tutorial
- Fixing Android unknown error 961 while downloading app
- Android AlertDialog with Yes No and Cancel Button
- Share or Send SMS via Android Intent
- The Android Virtual Device myEmulator is currently running an emulator and cannot be deleted.
- Pass data between two Android Activities and access it using Intent
- SQLite with Android Easy to Understand Tutorial that covers Select, Insert, Update and Delete
- [FIX] AndroidRuntime: FATAL EXCEPTION: main - java.lang.RuntimeException NullPointerException
- Android EditText Cursor Colour appears to be white
- Android Development - How to switch between two Activities
- Android xml error Attribute is missing the Android namespace prefix [Solution]
- Android : Remove ListView Separator/divider programmatically or using xml property
- Android is starting optimizing... app 1 of 1
- java.lang.NoClassDefFoundError android.support.v4.content.LocalBroadcastManager
- AlertDialog with single button example : Android
- Android : Exception raised during rendering: action_bar API 22
- Maven : java.lang.ClassNotFoundException: Xmx512m
- Android Lint app_name is not translated in af (Afrikaans) am (Amharic) ar (Arabic) bg (Bulgarian)
- Center align text in TextView Android Programming
- How to Download and Install Android adb Tool on Linux, Mac or Windows
- Multiline EditText in Android Example
More Posts:
- How to remove Extra Spaces in Notepad++ - NotepadPlusPlus
- Two Ways to Extract rar (*.rar) files on Mac - MacOS
- Java Multi-line String Example - Java
- Java 8 Leap year check using Year class from java.time api - Java
- Microsoft Lists and SharePoint Online edit grid view - use undo and redo changes - SharePoint
- How to get SharePoint List Item URL using PowerShell - SharePoint
- Docker Commit Command with Examples - Docker
- How to get Java Thread name Example [Program] - Java