title: Attempt to invoke virtual method 'int java.lang.Object.hashCode()' on a null object reference
body: <p>I'm trying to implement Facebook login button, but i'm receiving these errors when trying to run app:</p>
  
  <p>Error:</p>
  
  <pre><code>FATAL EXCEPTION: AsyncTask #4
  Process: , PID: 4633
  java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Object.hashCode()' on a null object reference
      at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:746)
      at java.util.concurrent.ConcurrentHashMap.containsKey(ConcurrentHashMap.java:774)
      at com.facebook.internal.Utility.queryAppSettings(Utility.java:825)
      at com.facebook.login.widget.LoginButton$1.run(LoginButton.java:489)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
      at java.lang.Thread.run(Thread.java:818)
  com.android.vlada.sportisa E/GoogleApiAvailability: Google Play services is invalid. Cannot recover.
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity implements GoogleApiClient.OnConnectionFailedListener {
  
      private Button buttonRegistrujSe, buttonPrijaviSeKaoGost, buttonPrijavaRegistrovaniKorisnik;
      private LoginButton loginButton;
      private CallbackManager callbackManager;
      private TextView info;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          FacebookSdk.sdkInitialize(getApplicationContext());
          setContentView(R.layout.activity_main);
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          FacebookSdk.sdkInitialize(getApplicationContext());
  
          GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                  .requestEmail()
                  .build();
  
          GoogleApiClient mGoogleApiClient;
          mGoogleApiClient = new GoogleApiClient.Builder(this)
                  .enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */)
                  .addApi(Auth.GOOGLE_SIGN_IN_API, gso)
                  .build();
  
          buttonRegistrujSe = (Button) (findViewById(R.id.button_registruj_se));
          buttonRegistrujSe.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  Intent i = new Intent(MainActivity.this, RegistrationActivity.class);
                  startActivity(i);
              }
          });
  
          buttonPrijaviSeKaoGost = (Button) (findViewById(R.id.button_prijavi_se_kao_gost));
          buttonPrijaviSeKaoGost.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  Intent i2 = new Intent(MainActivity.this, LoginGostActivity.class);
                  startActivity(i2);
              }
          });
  
          buttonPrijavaRegistrovaniKorisnik = (Button) (findViewById(R.id.button_prijava_registrovani_korisnik));
          buttonPrijavaRegistrovaniKorisnik.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  Intent i3 = new Intent(MainActivity.this, LoginActivity.class);
                  startActivity(i3);
              }
          });
  
          callbackManager = CallbackManager.Factory.create();
          setContentView(R.layout.activity_main);
          info = (TextView)findViewById(R.id.info);
          loginButton = (LoginButton)findViewById(R.id.connectWithFbButton);
  
          loginButton.registerCallback(callbackManager, new FacebookCallback&lt;LoginResult&gt;() {
              @Override
              public void onSuccess(LoginResult loginResult) {
                  info.setText(
                          "User ID: "
                                  + loginResult.getAccessToken().getUserId()
                                  + "\n" +
                                  "Auth Token: "
                                  + loginResult.getAccessToken().getToken()
                  );
              }
  
              @Override
              public void onCancel() {
                  info.setText("Login attempt canceled.");
              }
  
              @Override
              public void onError(FacebookException e) {
                  info.setText("Login attempt failed.");
              }
          });    
      }    
  
      @Override
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          callbackManager.onActivityResult(requestCode, resultCode, data);
      }    
  
      @Override
      protected void onDestroy() {
          super.onDestroy();
          System.exit(0);
      }
  
      @Override
      public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {   
      }
  }
  </code></pre>
  
  <p>Layout Code</p>
  
  <pre><code>&lt;com.facebook.login.widget.LoginButton
      android:id="@+id/connectWithFbButton"
      style="@style/com_facebook_loginview_default_style"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="center_horizontal"
      android:layout_above="@+id/sign_in_button"
      android:layout_centerHorizontal="true"
      android:layout_marginBottom="43dp" /&gt;
  </code></pre>
  
  <p>Update: after i deleted duplicate code in MainActivity i'm still receiving the same errors when trying to ran app. I'm attaching Manifest code also as requested so maybe that would help? Thanx</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;!-- To auto-complete the email text field in the login form with the user's emails --&gt;
  &lt;uses-permission android:name="android.permission.GET_ACCOUNTS" /&gt;
  &lt;uses-permission android:name="android.permission.READ_PROFILE" /&gt;
  &lt;uses-permission android:name="android.permission.READ_CONTACTS" /&gt;
  &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  
  &lt;permission
      android:name="com.android.vlada.sportisa.Entiteti.maps.permission.MAPS_RECEIVE"
      android:protectionLevel="signature" /&gt;
  
  &lt;uses-feature
      android:glEsVersion="0x00020000"
      android:required="true" /&gt;
  
  &lt;uses-permission android:name="com.android.vlada.sportisa.Entiteti.maps.permission.MAPS_RECEIVE" /&gt;
  
  &lt;meta-data
      android:name="com.google.android.maps.v2.API_KEY"
      android:value="AIzaSyAVb2JuN-5nbaVkGODivuXPJOF5OeRekzo" /&gt;
  &lt;meta-data
      android:name="com.facebook.sdk.ApplicationId"
      android:value="@string/facebook_login" /&gt;
  
  &lt;application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:supportsRtl="true"
      android:theme="@style/AppTheme" &gt;
      &lt;activity android:name=".MainActivity" /&gt;
      &lt;activity android:name=".SplashActivity" &gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
  
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
      &lt;activity android:name=".RegistrationActivity" /&gt;
      &lt;activity android:name=".LoginActivity" /&gt;
      &lt;activity android:name=".BiranjeAktivnosti" /&gt;
      &lt;activity
          android:name=".Trazim"
          android:label="@string/title_activity_trazim"
          android:theme="@style/AppTheme" /&gt;
      &lt;activity
          android:name=".Organizujem"
          android:label="@string/title_activity_organizujem"
          android:theme="@style/AppTheme" /&gt;
      &lt;activity
          android:name="com.facebook.FacebookActivity"
          android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
          android:label="@string/app_name"
          android:theme="@android:style/Theme.Translucent.NoTitleBar" /&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p></p>