Search code examples
javaandroidgoogle-developers-console

Android Google sign in returns RESULT_CANCELLED


The app I'm developing uses google sign. I want to authenticate these users on my server. It used to work, but after changing the computer I develop on and in stead of running on an avd I now use a real device. After these changes google sign in stopped working and always returns Activity.RESULT_CANCELLED So I tried to reconfigure everything in dev console with no luck. I followed the docs exactly for about 3 times now.

What I did:

        GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                .requestIdToken(clientId)
                .requestEmail()
                .build();
  • I also tried all other client-id's listed on the credentials page without luck

I'm not using the release build variant yet btw.

What am I doing wrong here?


Solution

  • It appeared my applicationId in my module level build.gradle file differed from my package name defined in my manifest file. Even though google states to use the package name in your manifest when you configure a project, you still have to make sure your build.gradle file has the same applicationId defined for some reason.