title: Android Facebook SDK: generate release key hash
body: <p>I'm building an app in which users can log in with Facebook.</p>
  
  <p>I've created the hash keys like following:</p>
  
  <pre><code>try {
           PackageInfo info = getPackageManager().getPackageInfo(
           "com.app.package",
           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(getApplicationContext(), Base64.encodeToString(md.digest(),
                   Base64.DEFAULT), Toast.LENGTH_LONG).show();
           }
           } catch (NameNotFoundException e) {
  
           } catch (NoSuchAlgorithmException e) {
  
           }
  </code></pre>
  
  <p>In debug mode, everything works well. </p>
  
  <p>When I export the project for release, it gives this error:</p>
  
  <pre><code>"Invalid key hash. The key hash ****************** does not match any stored key hashes"
  </code></pre>
  
  <p>I paste the key printed in the Facebook Developer dashboard, but the application still gives me that error.</p>
  
  <p>The complete package of my actvity is "<code>com.app.package.views</code>" and I tried to use this package (as Google Play Package Name) in the dashboard, but nothing changed.</p>
  
  <p>How can I solve it? How can I generate the right release key hash?</p>