You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Google One Tap登录报错Missing Feature{name=auth_api_credentials_begin_sign_in, version=8}

解决Google One Tap Missing Feature{name=auth_api_credentials_begin_sign_in, version=8} 错误

1. 更新设备的Google Play服务

这个错误的核心原因是设备上的Google Play服务版本太低,不支持v8版本的auth_api_credentials_begin_sign_in功能。直接打开Google Play商店搜索“Google Play服务”,更新到最新版本即可;如果使用模拟器,记得选择包含最新Google Play服务的系统镜像(优先选API 33及以上的Google Play镜像)。

2. 核对项目依赖库版本

在模块级的build.gradle文件中,确保Google身份服务相关依赖使用最新稳定版,示例如下:

dependencies {
    implementation 'com.google.android.gms:play-services-auth:20.7.0'
    implementation 'com.google.android.gms:play-services-auth-api-phone:18.1.0'
}

修改完成后同步项目,重新编译。

3. 检查客户端ID与云配置

  • 确认代码中使用的web_client_id是Google Cloud控制台生成的正确ID,且已与应用包名、签名证书指纹绑定。
  • 登录Google Cloud控制台,确保你的项目已启用Google Sign-In相关API。

4. 给AndroidManifest添加功能声明

在AndroidManifest.xml中加入以下声明,让应用能正确识别Google Play服务的对应功能:

<uses-feature
    android:name="com.google.android.gms.auth.api.credentials.begin_sign_in"
    android:required="false" />

5. 代码中加入版本检查逻辑

在调用beginSignIn前,先判断Google Play服务是否可用,提前拦截不兼容情况:

GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
int resultCode = apiAvailability.isGooglePlayServicesAvailable(this);
if (resultCode != ConnectionResult.SUCCESS) {
    if (apiAvailability.isUserResolvableError(resultCode)) {
        apiAvailability.getErrorDialog(this, resultCode, 9000).show();
    } else {
        Log.d("Google Login", "设备不支持Google Play服务");
    }
    return;
}

将这段代码放在按钮点击事件的最开头即可。


内容的提问来源于stack exchange,提问作者Tgarfr

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.25 00:15:06