title: Android Facebook SDK Not Working for Exported APK
body: <p>I have a very basic Android app using the Facebook SDK based on the example at <a href="https://developers.facebook.com/docs/android/getting-started/facebook-sdk-for-android/" rel="nofollow">https://developers.facebook.com/docs/android/getting-started/facebook-sdk-for-android/</a></p>
  
  <p>If I run it from ADT, it works and shows "opened". Since I have already authorized the app, it doesn't show a dialog and just displays the text "opened".</p>
  
  <p>If I export it as an apk and sign it with a new keystore that I just created, it works the same.</p>
  
  <p>However, if I export an apk and sign it with my actual keystore that I have used to sign my real apps, it doesn't work. First, it shows a dialog to access my public profile and friends list even though I have already authorized it, then after clicking OK it shows "closed" meaning session.isClosed() was true.</p>
  
  <p>I have all the key hashes of the debug, new, and actual keystore in the Facebook developer tool.</p>
  
  <p>What could be wrong? Is my keystore hosed?</p>
  
  <p>Here is the code of my app:</p>
  
  <pre><code>package com.example.newtest;
  
  import android.os.Bundle;
  import android.app.Activity;
  import android.content.Context;
  import android.content.Intent;
  import android.util.Log;
  import android.widget.TextView;
  import com.facebook.*;
  import com.facebook.model.*;
  
  public class MainActivity extends Activity {
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
  
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          Session.openActiveSession(this, true, new Session.StatusCallback() {
  
              @Override
              public void call(Session session, SessionState state, Exception exception) {
  
                  if (session.isOpened()) {
  
                      TextView welcome = (TextView) findViewById(R.id.welcome);
                      welcome.setText("opened");
  
                  } else if (session.isClosed()) {
  
                      TextView welcome = (TextView) findViewById(R.id.welcome);
                      welcome.setText("closed");
  
                  } else {
  
                      TextView welcome = (TextView) findViewById(R.id.welcome);
                      welcome.setText("neither opened nor closed");
                  }
              }
          });
      }
  
      @Override
      public void onActivityResult(int requestCode, int resultCode, Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
          Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data);
      }
  
  }
  </code></pre>