Home > Mobile >  error when making a Google Sign-In with FireBase on SignIn function. Cannot resolve method 'get
error when making a Google Sign-In with FireBase on SignIn function. Cannot resolve method 'get

Time:11-23

I'm trying to intergrade a google login with FireBase to my app but there seems to be an error on the signIn function, it doesn't say what error or how to fix it. can't get getSignInIntent from mGoogleSignInClient.

also when I try to run the program it shows an error that says "Duplicate resources".

image of the error

public class MainActivity extends AppCompatActivity {
    private Object mGoogleSignInClient;
    private  final static int RC_SIGN_IN = 1;
    Timer timer;
    private FirebaseAuth mAuth;

   

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initViews();
        CreateRequest();
    }

    public void initViews(){
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
        findViewById(R.id.google_signIn).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                signIn();
            }
        });
        mAuth = FirebaseAuth.getInstance();
    }

    private void CreateRequest() {
        // Configure Google Sign In
        GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                .requestIdToken(getString(R.string.default_web_client_id))
                .requestEmail()
                .build();

        mGoogleSignInClient = GoogleSignIn.getClient(this, gso);
    }
    private void signIn() {
        Intent signInIntent = mGoogleSignInClient.getSignInIntent();
        startActivityForResult(signInIntent, RC_SIGN_IN);
    }
    
}```

CodePudding user response:

Try with this, instead of

private Object mGoogleSignInClient; 

use:

private GoogleSignInClient mGoogleSignInClient;
  • Related