Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot resolve symbol default_web_client_id GoogleSignInOptions Android Firebase

My project works fine for last six month and app in play store. For an update, I reopen the project shows default_web_client not resolved for the following piece of code.

GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                .requestIdToken(getString(R.string.default_web_client_id))
                .requestEmail()
                .build();

I try the following methods,

1.Clean and rebuild

2.Clear cache and restart

3.Set getString(R.string.default_web_client_id) as empty string and run the project to generate

app/build/generated/res/google-services/{build_type}/values/values.xml

file as instruction from this link

4.Replace empty string with getString(R.string.default_web_client_id)

Now I able to run the project and also able to take release build. But still, Cannot resolve symbol default_web_client_id.

Any update would be helpful...

NB: Directly adding oauth_client->client_id will get an Error

W/GoogleActivity: Google sign in failed
    com.google.android.gms.common.api.ApiException: 12500: 
        at com.google.android.gms.common.internal.ApiExceptionUtil.fromStatus(Unknown Source) 
like image 475
Subin Babu Avatar asked Jan 23 '19 09:01

Subin Babu


4 Answers

I've got the same problem like you. After update Android studio, it getting error. There no need to fix because, Google try to make your app more and more secure. If you try to create another value for default_web_client_id it will show error dupplicate variable. To find the value of default_web_client_id * Change mode to Project -> app -> build -> generated -> google-services -> debug -> values -> values.xml. So, this cause no error when compiling, you no need to fix it. Let wating google fix it later :D

like image 62
Thân Hoàng Avatar answered Oct 18 '22 22:10

Thân Hoàng


I have updated google services version to the latest in Project level build.gradle and worked fine

classpath 'com.google.gms:google-services:4.2.0
like image 31
Naveen Kumar M Avatar answered Oct 18 '22 22:10

Naveen Kumar M


I get the same issue with my code also

Cannot resolve symbol 'default_web_client_id'

i have tried clientID as the argument instead of R.string.default_web_client_id)

.requestIdToken(*My Client Id*)

and get the following in the debug code

W/System.err: com.google.android.gms.common.api.ApiException: 12500:

I have update the google services to the latest in Project level build.gradle (google-serivces:4.2.0)

!The Solution which worked for me!

  1. Sign in to Developer Console

  2. Credentials > Create credentials >API key

  3. Download new google-services.json from Firebase (Project Overview > Users and Permissions > General scroll down
  4. Load new google-services.json into Project>app
  5. Replace Client id with new one generated from google-services.json oauth_client>client_id Note: Use client id with the client_type 3
.requestIdToken(*My New Client Id*)

6.Run your App :)

like image 24
Qaleem Hussain Avatar answered Oct 18 '22 21:10

Qaleem Hussain


Just come back to the previous classpath version from google services: In my case I had to change from classpath 'com.google.gms:google-services:4.3.10' to classpath 'com.google.gms:google-services:4.3.8' in the build.gradle panel. Sometimes the google services updates do not work properly and that is a good developer headache.

like image 43
CervanApps Avatar answered Oct 18 '22 21:10

CervanApps



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!