微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android的GooglePlus登录实现离子错误

如何解决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));

它只是完成而不在 then 或 catch 中打印任何内容。 我试图按照文档将 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"
    ]
  }
}

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

解决方法

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

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

它对我有用。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。