我正在构建一个react原生应用程序。当我将应用程序导出到APK文件时,谷歌登录不起作用。结果是:我点击";用谷歌登录";,它将提示我选择一个帐户,我选择该帐户,旋转器在"下旋转;accounts.google.com";,我被引导到谷歌网站的登陆页面。
在expo中,它会返回一个响应并将我重定向回应用程序。
这是我遵循的文档https://docs.expo.io/versions/latest/sdk/google/.我已经检查了三次,所以我确信我的SSA和API密钥是正确的。
有其他人遇到过这个问题吗?将安卓系统提交给apk是谷歌登录的常见问题吗?
const signInWithGoogleAsync = async (setLoggingIn) => {
setLoggingIn(true);
try {
const result = await Google.logInAsync({
androidClientId: GoogleClientId.Android,
iosClientId: GoogleClientId.iOS,
scopes: ["profile", "email"],
iosStandaloneAppClientId: GoogleClientId.iOSStandaloneApp,
androidStandaloneAppClientId: GoogleClientId.AndroidStandaloneApp,
});
console.log("GOOGLE LOGIN RES", result);
if (result.type === "success") {
onSignIn(result, setLoggingIn);
return result.accessToken;
} else {
setLoggingIn(false);
return {cancelled: true};
}
} catch (e) {
setLoggingIn(false);
return {error: true};
}
};
app.json
"android": {
"package": "123456789omittedforsecurity",
"versionCode": 2,
"config": {
"googleMaps": {
"apiKey": "123456789omittedforsecurity"
},
"googleSignIn": {
"apiKey": "123456789omittedforsecurity",
"certificateHash": "123456789omittedforsecurity"
}
},
"permissions": [
"ACCESS_COARSE_LOCATION",
"ACCESS_FINE_LOCATION",
"CAMERA",
"MANAGE_DOCUMENTS",
"READ_CONTACTS",
"READ_CALENDAR",
"WRITE_CALENDAR",
"READ_EXTERNAL_STORAGE",
"READ_PHONE_STATE",
"RECORD_AUDIO",
"USE_FINGERPRINT",
"VIBRATE",
"WAKE_LOCK",
"WRITE_EXTERNAL_STORAGE",
"com.anddoes.launcher.permission.UPDATE_COUNT",
"com.android.launcher.permission.INSTALL_SHORTCUT",
"com.google.android.c2dm.permission.RECEIVE",
"com.google.android.gms.permission.ACTIVITY_RECOGNITION",
"com.google.android.providers.gsf.permission.READ_GSERVICES",
"com.htc.launcher.permission.READ_SETTINGS",
"com.htc.launcher.permission.UPDATE_SHORTCUT",
"com.majeur.launcher.permission.UPDATE_BADGE",
"com.sec.android.provider.badge.permission.READ",
"com.sec.android.provider.badge.permission.WRITE",
"com.sonyericsson.home.permission.BROADCAST_BADGE"
]
},
顺便说一句:国际奥委会与世博会合作得很好。
作为更新,我不完全确定发生了什么,但问题停止了。我想是我的安卓设备出现了问题,我升级了设备,现在它可以工作了。