首页 > 解决方案 > android的GooglePlus登录实现离子错误

问题描述

我正在尝试为 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));

它只是在没有打印任何内容的情况下完成或捕获。我试图按照文档将 PLAY_SERVICES_VERSION 更改为 11.8.0,但它不起作用。

https://github.com/EddyVerbruggen/cordova-plugin-googleplus

并且 SHA1 验证可以执行this.googlePlus.getSigningCertificateFingerprint

离子版

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"
    ]
  }
}

请一些帮助,我花了一个多星期试图解决这个问题。

标签: androidcordovaionic-frameworkgoogle-plusgoogle-signin

解决方案


最后我发现了问题,它发生在实现@ionic-native/background-mode 时,我只是运行这个:

离子cordova插件删除cordova-plugin-background-mode npm卸载@ionic-native/background-mode

它对我有用。


推荐阅读