title: android studio: FATAL EXCEPTION: AsyncTask #5 while adding facebook login button
body: <p>It's been two days that i am getting this problem whenever i try adding a facebook login button in android studio.</p>
  
  <p><strong>MainActivity.java</strong>
   package org.example.rahul_a.firstapp;</p>
  
  <pre><code>import android.content.Intent;
  import android.os.Bundle;
  import android.support.v7.app.AppCompatActivity;
  import android.support.v7.widget.Toolbar;
  import android.view.View;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.widget.Button;
  import android.widget.TextView;
  import com.facebook.CallbackManager;
  import com.facebook.FacebookCallback;
  import com.facebook.FacebookException;
  import com.facebook.FacebookSdk;
  import com.facebook.login.LoginResult;
  import com.facebook.login.widget.LoginButton;
  import com.google.android.gms.auth.api.Auth;
  import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
  import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
  import com.google.android.gms.auth.api.signin.GoogleSignInResult;
  import com.google.android.gms.common.ConnectionResult;
  import com.google.android.gms.common.SignInButton;
  import com.google.android.gms.common.api.GoogleApiClient;
  
  
  
  public class MainActivity extends AppCompatActivity implements GoogleApiClient.OnConnectionFailedListener {
  
      private static final int REQUEST_CODE = 100;
      private SignInButton gbutton;
      private GoogleApiClient googleApiClient;
      private GoogleSignInOptions signInOptions;
      public String userName;
      private TextView t1;
      private Button b1;
      private LoginButton loginButton;
      private CallbackManager callbackManager;
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          FacebookSdk.sdkInitialize(getApplicationContext());
          setContentView(R.layout.activity_main);
          Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
          setSupportActionBar(toolbar);
          callbackManager = CallbackManager.Factory.create();
          loginButton = (LoginButton)findViewById(R.id.login_button);
          b1 = (Button) findViewById(R.id.button);
          signInOptions = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN).requestEmail().build();
          googleApiClient = new GoogleApiClient.Builder(this).enableAutoManage(this,this).addApi(Auth.GOOGLE_SIGN_IN_API, signInOptions).build();
          gbutton = (SignInButton) findViewById(R.id.gbutton);
  
          gbutton.setSize(SignInButton.SIZE_WIDE);
          gbutton.setScopes(signInOptions.getScopeArray());
          t1 = (TextView) findViewById(R.id.textView);
  
          gbutton.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(googleApiClient);
                  startActivityForResult(signInIntent, REQUEST_CODE);
              }
          });
  
          loginButton.registerCallback(callbackManager, new FacebookCallback&lt;LoginResult&gt;() {
              @Override
              public void onSuccess(LoginResult loginResult) {
  
              }
  
              @Override
              public void onCancel() {
  
              }
  
              @Override
              public void onError(FacebookException e) {
  
              }
          });
  
  
      }
  
      @Override
       protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          callbackManager.onActivityResult(requestCode, resultCode, data);
      super.onActivityResult(requestCode, resultCode, data);
  
      if (requestCode == REQUEST_CODE) {
          GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
          GoogleSignInAccount account = result.getSignInAccount();
  
          userName = account.getDisplayName();
          t1.setText("Welcome " + userName);
  
      }
  
  }
  
  
  
  @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.menu_main, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          // Handle action bar item clicks here. The action bar will
          // automatically handle clicks on the Home/Up button, so long
          // as you specify a parent activity in AndroidManifest.xml.
          int id = item.getItemId();
  
          //noinspection SimplifiableIfStatement
          if (id == R.id.action_settings) {
              return true;
          }
  
          return super.onOptionsItemSelected(item);
      }
  
      @Override
      public void onConnectionFailed(ConnectionResult connectionResult) {
  
      }
  
  }
  </code></pre>
  
  <p><strong>AndroidManifest.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="org.example.rahul_a.firstapp"&gt;
      &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
      &lt;meta-data android:name="com.facebook.sdk.ApplicationId"
          android:value="@string/facebook_app_id"/&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"
              android:label="@string/app_name"
              android:theme="@style/AppTheme.NoActionBar"&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="com.facebook.FacebookActivity"
              android:configChanges=
                  "keyboard|keyboardHidden|screenLayout|screenSize|orientation"
              android:theme="@android:style/Theme.Translucent.NoTitleBar"
              android:label="@string/app_name" /&gt;
  
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p><strong>LOGCAT DUMP</strong></p>
  
  <pre><code>03-29 22:36:10.036 30427-30427/? D/dalvikvm: Late-enabling CheckJNI
  03-29 22:36:10.136 30427-30427/org.example.rahul_a.firstapp I/dalvikvm: Could not find method android.content.pm.PackageManager.getPackageInstaller, referenced from method com.google.android.gms.common.zze.zzi
  03-29 22:36:10.136 30427-30427/org.example.rahul_a.firstapp W/dalvikvm: VFY: unable to resolve virtual method 574: Landroid/content/pm/PackageManager;.getPackageInstaller ()Landroid/content/pm/PackageInstaller;
  03-29 22:36:10.136 30427-30427/org.example.rahul_a.firstapp D/dalvikvm: VFY: replacing opcode 0x6e at 0x000b
  03-29 22:36:10.166 30427-30427/org.example.rahul_a.firstapp I/GMPM: App measurement is starting up, version: 8487
  03-29 22:36:10.166 30427-30427/org.example.rahul_a.firstapp I/GMPM: To enable debug logging run: adb shell setprop log.tag.GMPM VERBOSE
  03-29 22:36:10.176 30427-30427/org.example.rahul_a.firstapp E/GMPM: GoogleService failed to initialize, status: 10, Missing an expected resource: 'R.string.google_app_id' for initializing Google services.  Possible causes are missing google-services.json or com.google.gms.google-services gradle plugin.
  03-29 22:36:10.176 30427-30427/org.example.rahul_a.firstapp E/GMPM: Scheduler not set. Not logging error/warn.
  03-29 22:36:10.196 30427-30427/org.example.rahul_a.firstapp W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/view/SearchEvent;)
  03-29 22:36:10.196 30427-30427/org.example.rahul_a.firstapp I/dalvikvm: Could not find method android.view.Window$Callback.onSearchRequested, referenced from method android.support.v7.view.WindowCallbackWrapper.onSearchRequested
  03-29 22:36:10.196 30427-30427/org.example.rahul_a.firstapp W/dalvikvm: VFY: unable to resolve interface method 19943: Landroid/view/Window$Callback;.onSearchRequested (Landroid/view/SearchEvent;)Z
  03-29 22:36:10.196 30427-30427/org.example.rahul_a.firstapp D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
  03-29 22:36:10.196 30427-30427/org.example.rahul_a.firstapp I/dalvikvm: Could not find method android.view.Window$Callback.onWindowStartingActionMode, referenced from method android.support.v7.view.WindowCallbackWrapper.onWindowStartingActionMode
  03-29 22:36:10.196 30427-30427/org.example.rahul_a.firstapp W/dalvikvm: VFY: unable to resolve interface method 19947: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
  03-29 22:36:10.196 30427-30427/org.example.rahul_a.firstapp D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
  03-29 22:36:10.196 30427-30427/org.example.rahul_a.firstapp D/dalvikvm: GetMethodID: not returning static method Landroid/os/Process;.getTotalMemory ()J
  03-29 22:36:10.196 30427-30427/org.example.rahul_a.firstapp D/dalvikvm: GetMethodID: not returning static method Landroid/os/Process;.getFreeMemory ()J
  03-29 22:36:10.196 30427-30458/org.example.rahul_a.firstapp E/GMPM: Uploading is not possible. App measurement disabled
  03-29 22:36:10.236 30427-30427/? I/dalvikvm: Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.widget.TintTypedArray.getChangingConfigurations
  03-29 22:36:10.236 30427-30427/? W/dalvikvm: VFY: unable to resolve virtual method 653: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
  03-29 22:36:10.236 30427-30427/? D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
  03-29 22:36:10.236 30427-30427/? I/dalvikvm: Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.widget.TintTypedArray.getType
  03-29 22:36:10.236 30427-30427/? W/dalvikvm: VFY: unable to resolve virtual method 675: Landroid/content/res/TypedArray;.getType (I)I
  03-29 22:36:10.236 30427-30427/? D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
  03-29 22:36:10.266 30427-30427/? I/dalvikvm: DexOpt: not all deps represented
  03-29 22:36:10.266 30427-30427/? E/dalvikvm: /system/framework/com.android.location.provider.jar odex has stale dependencies
  03-29 22:36:10.266 30427-30427/? I/dalvikvm: DexOpt: not all deps represented
  03-29 22:36:10.266 30427-30427/? E/dalvikvm: /system/framework/com.android.media.remotedisplay.jar odex has stale dependencies
  03-29 22:36:10.296 30427-30427/? I/dalvikvm: Could not find method android.content.res.Resources.getDrawable, referenced from method android.support.v7.widget.ResourcesWrapper.getDrawable
  03-29 22:36:10.296 30427-30427/? W/dalvikvm: VFY: unable to resolve virtual method 616: Landroid/content/res/Resources;.getDrawable (ILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
  03-29 22:36:10.296 30427-30427/? D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
  03-29 22:36:10.296 30427-30427/? I/dalvikvm: Could not find method android.content.res.Resources.getDrawableForDensity, referenced from method android.support.v7.widget.ResourcesWrapper.getDrawableForDensity
  03-29 22:36:10.296 30427-30427/? W/dalvikvm: VFY: unable to resolve virtual method 618: Landroid/content/res/Resources;.getDrawableForDensity (IILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
  03-29 22:36:10.296 30427-30427/? D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
  03-29 22:36:10.366 30427-30472/? I/dalvikvm: Could not find method android.app.Notification$Builder.setLocalOnly, referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza
  03-29 22:36:10.366 30427-30472/? W/dalvikvm: VFY: unable to resolve virtual method 261: Landroid/app/Notification$Builder;.setLocalOnly (Z)Landroid/app/Notification$Builder;
  03-29 22:36:10.366 30427-30472/? D/dalvikvm: VFY: replacing opcode 0x6e at 0x00c8
  03-29 22:36:10.406 30427-30427/? I/Adreno-EGL: &lt;qeglDrvAPI_eglInitialize:410&gt;: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_LNX.LA.3.5.2.2.2_RB1.04.04.04.154.004_msm8226_LNX.LA.3.5.2.2.2_RB1__release_AU ()
                                                 OpenGL ES Shader Compiler Version: E031.24.00.15
                                                 Build Date: 08/06/14 Wed
                                                 Local Branch: mybranch4057433
                                                 Remote Branch: quic/LNX.LA.3.5.2.2.2_rb1
                                                 Local Patches: NONE
                                                 Reconstruct Branch: AU_LINUX_ANDROID_LNX.LA.3.5.2.2.2_RB1.04.04.04.154.004 +  NOTHING
  03-29 22:36:10.436 30427-30427/? D/OpenGLRenderer: Enabling debug mode 0
  03-29 22:36:10.446 30427-30475/? W/dalvikvm: threadid=19: thread exiting with uncaught exception (group=0x41da6d58)
  03-29 22:36:10.446 30427-30475/? E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #5
                                                     Process: org.example.rahul_a.firstapp, PID: 30427
                                                     java.lang.NullPointerException
                                                         at java.util.concurrent.ConcurrentHashMap.containsKey(ConcurrentHashMap.java:911)
                                                         at com.facebook.internal.Utility.queryAppSettings(Utility.java:823)
                                                         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:841)
  03-29 22:36:10.456 30427-30475/? I/Process: Sending signal. PID: 30427 SIG: 9
  </code></pre>
  
  <p>All this was working without facebook login button.</p>