NULL Pointer Exception when integrating g+ Signin

后端 未结 1 1806
无人共我
无人共我 2021-01-29 08:30

This is my code

public class gsign extends Activity implements ConnectionCallbacks,OnConnectionFailedListener {
private static final int RC_SIGN_IN = 0;
private          


        
1条回答
  •  半阙折子戏
    2021-01-29 09:07

    The stack trace tells it all...

    You don't call mGoogleApiClient.connect() until onStart(). Meanwhile back in onCreate(), which is called before onStart(), you call the signInWithGplus(); method.

    !mGoogleApiClient.isConnecting() in that method is true leading to resolveSignInError() being called.

    You have not yet assigned a value to mConnectionResult so calling mConnectionResult.hasResolution() in resolveSignInError() will throw a NullPointerException.

    0 讨论(0)
提交回复
热议问题