android的GooglePlus登录实现离子错误
Posted
技术标签:
【中文标题】android的GooglePlus登录实现离子错误【英文标题】:GooglePlus login for android implements on ionic error 【发布时间】:2021-09-17 05:40:13 【问题描述】:我正在尝试为 android 应用实现 googlePlus 登录,但是当我调用该函数时
this.googlePlus.login(
'webClientId': 'XXXXXXXXXXXXXXX-XXXXXXXXXXXXXX.XXXX.XXXXXXXXXXXXXXXX.XXX',
'offline': true
).then( obj=>
this.afAuth.signInWithCredential(firebase.auth.GoogleAuthProvider.credential(e.idToken));)
.catch(e => console.log('Error login', e));
它只是在 then 或 catch 中没有打印任何内容就完成了。 我试图按照文档将 PLAY_SERVICES_VERSION 更改为 11.8.0,但它不起作用。
https://github.com/EddyVerbruggen/cordova-plugin-googleplus
执行this.googlePlus.getSigningCertificateFingerprint
的SHA1验证没问题
离子版本
6.11.0 科尔多瓦版本: 10.0.0
我的 package.json
"name": "XXXX",
"version": "1.0.0",
"author": "Ionic Framework",
"homepage": "https://ionicframework.com/",
"scripts":
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
,
"private": true,
"dependencies":
"@angular/common": "~8.2.14",
"@angular/core": "~8.2.14",
"@angular/fire": "^6.0.0",
"@angular/forms": "~8.2.14",
"@angular/platform-browser": "~8.2.14",
"@angular/platform-browser-dynamic": "~8.2.14",
"@angular/router": "~8.2.14",
"@capacitor/core": "2.0.2",
"@ionic-native/background-mode": "^5.28.0",
"@ionic-native/calendar": "^4.20.0",
"@ionic-native/core": "^5.0.7",
"@ionic-native/facebook": "^5.25.0",
"@ionic-native/fcm": "^5.28.0",
"@ionic-native/geolocation": "^5.26.0",
"@ionic-native/google-maps": "^5.5.0",
"@ionic-native/google-plus": "^5.24.0",
"@ionic-native/local-notifications": "^5.28.0",
"@ionic-native/native-geocoder": "^5.26.0",
"@ionic-native/splash-screen": "^5.0.0",
"@ionic-native/status-bar": "^5.0.0",
"@ionic/angular": "^5.0.0",
"angular-geocoder": "^9.2.0",
"cordova-android": "8.1.0",
"cordova-ios": "5.1.1",
"cordova-plugin-add-swift-support": "^2.0.2",
"cordova-plugin-calendar": "^5.1.5",
"cordova-plugin-facebook4": "^6.4.0",
"cordova-plugin-gaodelocation-chenyu": "^2.0.5",
"cordova-plugin-geolocation": "^4.0.2",
"cordova-plugin-googlemaps": "^2.7.1",
"cordova-plugin-googleplus": "^8.4.0",
"cordova-plugin-nativegeocoder": "^3.4.1",
"core-js": "^2.5.4",
"firebase": "^7.14.2",
"ionic2-calendar": "^0.6.6",
"native-run": "^1.0.0",
"rxjs": "~6.5.1",
"tslib": "^1.9.0",
"zone.js": "~0.9.1"
,
"devDependencies":
"@angular-devkit/build-angular": "^0.803.26",
"@angular/cli": "8.3.26",
"@angular/compiler": "~8.2.14",
"@angular/compiler-cli": "~8.2.14",
"@angular/language-service": "~8.2.14",
"@capacitor/cli": "2.0.2",
"@ionic/angular-toolkit": "^2.1.1",
"@ionic/lab": "^3.1.7",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "^5.0.0",
"cordova-plugin-androidx": "^2.0.0",
"cordova-plugin-androidx-adapter": "^1.1.1",
"cordova-plugin-background-mode": "^0.7.3",
"cordova-plugin-badge": "^0.8.8",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-fcm-with-dependecy-updated": "^7.3.1",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-ionic-webview": "^4.2.1",
"cordova-plugin-local-notification": "^0.9.0-beta.3",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^5.0.8",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "^7.0.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.4.3"
,
"description": "An Ionic project",
"cordova":
"plugins":
"cordova-plugin-whitelist": ,
"cordova-plugin-statusbar": ,
"cordova-plugin-device": ,
"cordova-plugin-splashscreen": ,
"cordova-plugin-ionic-webview":
"ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
,
"cordova-plugin-ionic-keyboard": ,
"cordova-plugin-googleplus":
"REVERSED_CLIENT_ID": "com.googleusercontent.apps.714643824110-a9dslj384jl1pncf8tco5p48611nhaj3",
"PLAY_SERVICES_VERSION": "11.8.0"
,
"cordova-plugin-facebook4":
"APP_ID": "XXXXXXXXXXXXXXXXXX",
"APP_NAME": "XXXXXX",
"FACEBOOK_HYBRID_APP_EVENTS": "false",
"FACEBOOK_ANDROID_SDK_VERSION": "5.13.0"
,
"cordova-plugin-geolocation": ,
"cordova-plugin-nativegeocoder": ,
"cordova-plugin-calendar": ,
"cordova-plugin-fcm-with-dependecy-updated":
"ANDROID_FCM_VERSION": "19.0.0",
"ANDROID_GRADLE_TOOLS_VERSION": "3.5.3",
"ANDROID_GOOGLE_SERVICES_VERSION": "4.3.3",
"ANDROID_DEFAULT_NOTIFICATION_ICON": "@mipmap/ic_launcher"
,
"cordova-plugin-androidx": ,
"cordova-plugin-androidx-adapter": ,
"cordova-plugin-background-mode": ,
"cordova-plugin-local-notification":
,
"platforms": [
"android",
"ios"
]
请帮忙,我花了一个多星期试图解决这个问题。
【问题讨论】:
您是否测试应用程序的签名版本?这些点你仔细检查了吗:github.com/EddyVerbruggen/cordova-plugin-googleplus#android? 【参考方案1】:最后我发现了问题,它是在实现@ionic-native/background-mode 时发生的,我只是运行这个:
ionic cordova 插件删除 cordova-plugin-background-mode npm卸载@ionic-native/background-mode
它对我有用。
【讨论】:
以上是关于android的GooglePlus登录实现离子错误的主要内容,如果未能解决你的问题,请参考以下文章
Google Plus 跨平台单点登录:onConnected 从未在全新安装中调用
Google 使用 g-plus 最新 API 在 android 中登录和注销