MediaService call back throws Null Pointer Exception

android
media-upload

#1

This is how I am trying to post image…

 RequestBody file = RequestBody.create(MediaType.parse("image/*"), mediaPath);
        TwitterApiClient authClient = TwitterCore.getInstance().getApiClient(session);
        MediaService ms = authClient.getMediaService();
        ms.upload(file, null, null).enqueue(new Callback<Media>() {
            @Override
            public void success(Result<Media> result) {
                Log.e(TAG, "result ID: " + result.data.mediaId);
            }

            @Override
            public void failure(TwitterException e) {
                e.printStackTrace();
            }
        });

It gives me a null pointer exception.

java.lang.NullPointerException: Attempt to invoke interface method 'boolean java.util.List.isEmpty()' on a null object reference

#2

Moving to the Twitter Kit category since this is specific to mobile.