title: Attempt to invoke virtual method 'void com.facebook.login.widget.LoginButton.setReadPermissions(java.lang.String[])' on a null object reference
body: <p>I tried to make a Facebook connection, but it seems I made a mistake, and now my Facebook button crashes.</p>
  
  <pre><code>public class FacebookConnect extends AppCompatActivity {
  
      private CallbackManager callbackManager;
      private AccessTokenTracker accessTokenTracker;
      private ProfileTracker profileTracker;
      public String TAG;
  
  
      private FacebookCallback&lt;LoginResult&gt; callback = new FacebookCallback&lt;LoginResult&gt;() {
          @Override
          public void onSuccess(LoginResult loginResult) {
              Profile profile = Profile.getCurrentProfile();
              nextActivity(profile);
          }
  
          @Override
          public void onCancel() {
  
          }
  
          @Override
          public void onError(FacebookException error) {
              System.out.println("test");
          }
      };
  
      @Override
      public void onCreate(Bundle savedInstanceState){
          super.onCreate(savedInstanceState);
          callbackManager = CallbackManager.Factory.create();
          accessTokenTracker = new AccessTokenTracker() {
              @Override
              protected void onCurrentAccessTokenChanged(AccessToken oldAccessToken,
                                                         AccessToken currentAccessToken) {
              }
          };
          profileTracker = new ProfileTracker() {
              @Override
              protected void onCurrentProfileChanged(Profile oldProfile, Profile currentProfile) {
                  nextActivity(currentProfile);
              }
          };
          accessTokenTracker.startTracking();
          profileTracker.startTracking();
          LoginButton loginButton = (LoginButton)findViewById(R.id.facebookSignupButton);
          loginButton.setReadPermissions("user_friends");
          loginButton.registerCallback(callbackManager, callback);
          new FacebookCallback&lt;LoginResult&gt;() {
              @Override
              public void onSuccess(LoginResult loginResult) {
                  Profile profile = Profile.getCurrentProfile();
                  nextActivity(profile);
                  Toast.makeText(getApplicationContext(), "Log in", Toast.LENGTH_SHORT).show();
              }
  
              @Override
              public void onCancel() {
  
              }
  
              @Override
              public void onError(FacebookException error) {
  
              }
          };
      }
      @Override
      protected void onResume(){
          super.onResume();
          Profile profile = Profile.getCurrentProfile();
          nextActivity(profile);
      }
  
      protected void onPause(){
          super.onPause();
      }
  
      protected void onStop(){
          super.onStop();
          accessTokenTracker.stopTracking();
          profileTracker.stopTracking();
      }
  
      @Override
      public void onActivityResult(int requestCode, int resultCode, Intent data){
          super.onActivityResult(requestCode, resultCode, data);
          callbackManager.onActivityResult(requestCode, resultCode, data);
      }
  
      private void nextActivity(Profile profile){
          if (profile != null){
              Intent main = new Intent(this, NavigationActivity.class);
              main.putExtra("name", profile.getFirstName());
              main.putExtra("surname", profile.getLastName());
              main.putExtra("imageUrl", profile.getProfilePictureUri(200,200).toString());
              Log.d(TAG, "Connected");
              startActivity(main);
          }
      }
  }
  </code></pre>
  
  <p>Do you know how to solve it ?</p>
  
  <p>This is actually the error when I clicked on, I have the same problem when I tried make a google connection too.</p>
  
  <blockquote>
    <p>12-07 19:54:48.717 3772-3772/com.climb.eip.climb E/AndroidRuntime: FATAL EXCEPTION: main
                                                                           Process: com.climb.eip.climb, PID: 3772
                                                                           java.lang.RuntimeException: Unable to start activity
    ComponentInfo{com.climb.eip.climb/com.climb.eip.climb.utils.FacebookConnect}:
    java.lang.NullPointerException: Attempt to invoke virtual method 'void
    com.facebook.login.widget.LoginButton.setReadPermissions(java.lang.String[])'
    on a null object reference
                                                                               at
    android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)
                                                                               at
    android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
                                                                               at android.app.ActivityThread.-wrap12(ActivityThread.java)
                                                                               at
    android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
                                                                               at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                               at android.os.Looper.loop(Looper.java:154)
                                                                               at android.app.ActivityThread.main(ActivityThread.java:6077)
                                                                               at java.lang.reflect.Method.invoke(Native Method)
                                                                               at
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
                                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
                                                                            Caused by: java.lang.NullPointerException: Attempt to invoke virtual
    method 'void
    com.facebook.login.widget.LoginButton.setReadPermissions(java.lang.String[])'
    on a null object reference
                                                                               at
    com.climb.eip.climb.utils.FacebookConnect.onCreate(FacebookConnect.java:76)
                                                                               at android.app.Activity.performCreate(Activity.java:6662)
                                                                               at
    android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
                                                                               at
    android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
                                                                               at
    android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707) 
                                                                               at android.app.ActivityThread.-wrap12(ActivityThread.java) 
                                                                               at
    android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460) 
                                                                               at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                               at android.os.Looper.loop(Looper.java:154) 
                                                                               at android.app.ActivityThread.main(ActivityThread.java:6077) 
                                                                               at java.lang.reflect.Method.invoke(Native Method) 
                                                                               at
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866) 
                                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)</p>
  </blockquote>