解决方法
尝试了很多次后,我得到片段的解决方案,给我一个释放密钥哈希.
try { PackageInfo info = getActivity().getPackageManager().getPackageInfo( "com.yourappname.app",PackageManager.GET_SIGNATURES); for (Signature signature : info.signatures) { MessageDigest md = MessageDigest.getInstance("SHA"); md.update(signature.toByteArray()); Log.d("KeyHash","KeyHash:" + Base64.encodeToString(md.digest(),Base64.DEFAULT)); Toast.makeText(getActivity().getApplicationContext(),Base64.encodeToString(md.digest(),Base64.DEFAULT),Toast.LENGTH_LONG).show(); } } catch (PackageManager.NameNotFoundException e) { } catch (NoSuchAlgorithmException e) { }
我从here获得了终端的这个命令,它给了我释放密钥哈希.
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64