I am developing an app with facebook auth. I have generated Hash Key for releasing the APK using below command.
keytool -exportcert -alias YOUR_RELEASE_KEY_ALIAS -keystore YOUR_RELEASE_KEY_PATH | openssl sha1 -binary | openssl base64
After setting Hash Key generated by above command, I tried to login with facebook with a release APK. But I could not login and every time get the invalid Hash key error.
Also, I have tried to generate Hash key using below code and it's working well with debug APK, not release APK.
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);
}
I can not get that what's the issue. I have already found this issue on the internet. But those solutions didn't work. So if anyone knows the solution, it will be appreciated.