无法解析符号default_web_client_id GoogleSignInOptions Android Firebase [英] Cannot resolve symbol default_web_client_id GoogleSignInOptions Android Firebase

查看:365
本文介绍了无法解析符号default_web_client_id GoogleSignInOptions Android Firebase的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目在过去的六个月中都可以正常运行,并且可以在Play商店中正常运行.对于更新,我重新打开该项目,显示以下代码段未解析default_web_client.

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();

我尝试以下方法,

1.清理并重建

2.清除缓存并重新启动

2.Clear cache and restart

3.将getString(R.string.default_web_client_id)设置为空字符串并运行项目以生成

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

作为链接

4.用getString(R.string.default_web_client_id)

现在,我可以运行该项目,也可以进行发布了.但是,仍然无法解析符号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...

注意:直接添加oauth_client->client_id会出现错误

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) 

推荐答案

我的代码也遇到了同样的问题

I get the same issue with my code also

Cannot resolve symbol 'default_web_client_id'

我尝试使用clientID作为参数,而不是R.string.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:

我已将Google服务更新到项目级别build.gradle的最新版本(google-serivces:4.2.0)

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. 登录开发者控制台

凭据>创建凭据> API密钥

Credentials > Create credentials >API key

.requestIdToken(*My New Client Id*)

6.运行您的应用程序:)

6.Run your App :)

这篇关于无法解析符号default_web_client_id GoogleSignInOptions Android Firebase的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆