Reputation: 139
I have a problem with adding Google authentication to my project.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sign_up);
signUpBtn = (ImageView) findViewById(R.id.uSingUpBtn);
mGoogleSignInClient = GoogleSignIn.getClient(this,gso); <<error: cannot find symbol variable so
Android Studio cannot find gso
, I don't know why. Please help, or just let me know what 'gso' means. Thanks.
Upvotes: 0
Views: 206
Reputation: 139019
You are getting that error because GoogleSignIn's getClient(Context context, GoogleSignInOptions options) method, as you can see requires a GoogleSignInOptions
object as the second parameter. So in order to create a GoogleSignInClient
a GoogleSignInOptions
object is needed.
To solve this, you can create that object like this:
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getString(R.string.default_web_client_id))
.requestEmail()
.build();
Now, the following line of code will work:
mGoogleSignInClient = GoogleSignIn.getClient(this,gso);
Upvotes: 1