Android

debug.keystore の hashを確認する方法

More than 3 years have passed since last update.

try {

PackageInfo info = getPackageManager().getPackageInfo(
"パッケージ名",
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) {

}


shell

keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64



shell

keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl md5