Java – Throws a NullPointerException for logInInBackground parsing

Throws a NullPointerException for logInInBackground parsing… here is a solution to the problem.

Throws a NullPointerException for logInInBackground parsing

I have a login method :

private void login() {
    String username =;
    String password = this.password.getText().toString();

ParseUser.logInInBackground(username, password, new LogInCallback() {
        public void done(ParseUser user, ParseException e) {
            if (user != null) {
                 Successful login. Redirect to the main screen.
            } else {
                 We failed. Notify the user and log.
                message.setText("Error logging in. Please try again later.");
                Log.e("Error", "Error logging in user", e);

Looks good, however, when I try to log in, I get a NullPointerException statement:

java.lang.NullPointerException: Attempt to invoke virtual method 'com.parse.ParseHttpClient com.parse.ParsePlugins.restClient()' on a null object reference

Now, at first, I blame Parse, but I wonder if I’m missing something. Parse has been added to my Gradle dependencies in the following way:

compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.parse:parse-android:1.10.3'

Did I declare my dependency error? Is this a bug in parsing, or am I just using the method by mistake.


Have you changed the application in the list?

Remember it when you’ve done all of these things

    android:name=".android. ParseApplication"

Really important! I just forgot about it

Related Problems and Solutions