title: android facebook API Key hash not match any store key hashes
body: <p>I know that's a question answered before, but no one seems to work and i spend a week on int.</p>
  
  <p>I tried to get my Key Hash from key tool and put them on Facebook app Key hashes, release and debug. No one worked.
  "(404) Key hash xxxxxxxxxxxx does not match any storeed key hashes"
  That's rare, my keys are different.</p>
  
  <p>So i tried:</p>
  
  <pre><code>PackageInfo info = getPackageManager().getPackageInfo(
                                      "com.pakage.example", 
                                      PackageManager.GET_SIGNATURES);
                              for (Signature signature : info.signatures) {
                                  MessageDigest md = MessageDigest.getInstance("SHA");
                                  md.update(signature.toByteArray());
                                  String result = Base64.encodeToString(md.digest(), Base64.DEFAULT);
                                  Toast.makeText(MainActivity.this , result + result.toUpperCase(), Toast.LENGTH_LONG).show();
                              }    
  </code></pre>
  
  <p>That return me  the same Key Has request by Facebook (xxxxxxxxxxxx), so i added them to Facebook App, but Facebook return me "(404) Key hash xxxxxxxxxxxx does not match any storeed key hashes".</p>
  
  <p>When i removed Facebook App from my device, i was avaliebe to share status via  WebDialog.</p>
  
  <p>My final code seems to:</p>
  
  <pre><code>if (FacebookDialog.canPresentShareDialog(parent, FacebookDialog.ShareDialogFeature.SHARE_DIALOG)) 
      {
          publishFacebookDialog(points);  //FacebookDialog
      } 
      else 
      {
          Session session = Session.getActiveSession();
          if (session != null &amp;&amp; session.isOpened()) {
             publishFeedDialog(points);  //WebDialog
          }
          else
          {
              Intent intent = new Intent(parent, LoginUsingCustomFragmentActivity.class); //From FacebookSDK demo
              parent.startActivityForResult(intent, 666);        
          }
      }
  </code></pre>
  
  <p>PublishFacebookDialog function:</p>
  
  <pre><code>private void publishFacebookDialog(String puntuacion) {
      FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(parent)
      .setLink("bla")
      .setCaption("bla")
      .setName("bla")
      .build();
      uiHelper.trackPendingDialogCall(shareDialog.present());
  }
  </code></pre>
  
  <p>PublishFeedDialog function:</p>
  
  <pre><code>private void publishFeedDialog(String puntuacion) {
      Bundle params = new Bundle();
      params.putString("name", "bla");
      params.putString("caption", "bla");
      params.putString("link", "bla");
  
      WebDialog feedDialog = ( new WebDialog.FeedDialogBuilder(parent,Session.getActiveSession(),params))
          .setOnCompleteListener(new OnCompleteListener() {
  
              @Override
              public void onComplete(Bundle values, FacebookException error) {
                  if (error == null) {
                      final String postId = values.getString("post_id");
                      if (postId != null) {
  
                      } else {
  
                      }
                  } else if (error instanceof FacebookOperationCanceledException) {
                      // User clicked the "x" button
  
                  } else {
                      // Generic, ex: network error
  
                  }
              }
  
          })
          .build();
      feedDialog.show();
  }
  </code></pre>
  
  <p>The LoginUsingCustomFragmentActivity class is the same that FacebookSDK</p>
  
  <p>Tried:</p>
  
  <ul>
  <li>Remove app from facebook and re add.</li>
  <li>Replace symbols like /_+ etc, like from other answered posts.</li>
  <li>Use the same key hash reported by "(404) Key hash xxxxxxxxxxxx does not ...." on Facebook App.</li>
  </ul>
  
  <p>Any idea?</p>
  
  <p>Lot of thanks.</p>