Error when installed FCM plugin

I am trying to use push notifications ( firebase cloud messages), following this tutorial (here),
I have installed the plugin ( ionic cordova plugin add cordova-plugin-fcm-with-dependecy-updated, then npm install @ionic-native/fcm) then tried ionic cordova run android. And faced the following error:

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine the dependencies of task ‘:app:compileDebugJavaWithJavac’.

Could not resolve all task dependencies for configuration ‘:app:debugCompileClasspath’.
Could not resolve com.google.android.gms:play-services-base:[15.0.1,16.0.0).
Required by:
project :app > com.google.android.gms:play-services-identity:15.0.1
Skipped due to earlier error
Skipped due to earlier error
Skipped due to earlier error
Could not resolve com.google.android.gms:play-services-basement:[15.0.1,16.0.0).
Required by:
project :app > com.google.android.gms:play-services-identity:15.0.1
Failed to list versions for com.google.android.gms:play-services-basement.
Unable to load Maven meta-data from https://jcenter.bintray.com/com/google/android/gms/play-services-basement/maven-metadata.xml.
Could not get resource ‘https://jcenter.bintray.com/com/google/android/gms/play-services-basement/maven-metadata.xml’.
Could not GET ‘https://jcenter.bintray.com/com/google/android/gms/play-services-basement/maven-metadata.xml’.
Read timed out

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 43s
E:\Projects\DeliveryFamily-11-4-2020-START\platforms\android\gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine the dependencies of task ‘:app:compileDebugJavaWithJavac’.

Could not resolve all task dependencies for configuration ‘:app:debugCompileClasspath’.
Could not resolve com.google.android.gms:play-services-base:[15.0.1,16.0.0).
Required by:
project :app > com.google.android.gms:play-services-identity:15.0.1
Skipped due to earlier error
Skipped due to earlier error
Skipped due to earlier error
Could not resolve com.google.android.gms:play-services-basement:[15.0.1,16.0.0).
Required by:
project :app > com.google.android.gms:play-services-identity:15.0.1
Failed to list versions for com.google.android.gms:play-services-basement.
Unable to load Maven meta-data from https://jcenter.bintray.com/com/google/android/gms/play-services-basement/maven-metadata.xml.
Could not get resource ‘https://jcenter.bintray.com/com/google/android/gms/play-services-basement/maven-metadata.xml’.
Could not GET ‘https://jcenter.bintray.com/com/google/android/gms/play-services-basement/maven-metadata.xml’.
Read timed out

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 43s
[ERROR] An error occurred while running subprocess cordova.

    cordova.cmd build android --device exited with exit code 1

And this is my package.json file:


"dependencies": {
    "@angular/common": "~8.1.2",
    "@angular/compiler": "~8.1.2",
    "@angular/core": "~8.1.2",
    "@angular/fire": "^5.2.3",
    "@angular/forms": "~8.1.2",
    "@angular/platform-browser": "~8.1.2",
    "@angular/platform-browser-dynamic": "~8.1.2",
    "@angular/router": "~8.1.2",
    "@capacitor/core": "1.2.1",
    "@ionic-native/camera": "^5.16.0",
    "@ionic-native/clipboard": "^5.22.0",
    "@ionic-native/core": "^5.16.0",
    "@ionic-native/crop": "^5.16.0",
    "@ionic-native/facebook": "^5.23.0",
    "@ionic-native/fcm": "^5.23.0",
    "@ionic-native/file": "^5.23.0",
    "@ionic-native/file-path": "^5.16.0",
    "@ionic-native/firebase": "^5.22.0",
    "@ionic-native/globalization": "^5.0.0",
    "@ionic-native/google-plus": "^5.23.0",
    "@ionic-native/image-picker": "^5.16.0",
    "@ionic-native/ionic-webview": "^5.16.0",
    "@ionic-native/splash-screen": "^5.16.0",
    "@ionic-native/status-bar": "^5.16.0",
    "@ionic/angular": "^4.11.5",
    "@ionic/storage": "^2.2.0",
    "@ngrx/effects": "^8.5.1",
    "@ngrx/entity": "^8.5.1",
    "@ngrx/store": "^8.5.1",
    "@ngx-translate/core": "^12.1.2",
    "@ngx-translate/http-loader": "^4.0.0",
    "angularfire": "^2.3.0",
    "cordova-android": "^8.1.0",
    "cordova-clipboard": "^1.3.0",
    "cordova-plugin-androidx": "^1.0.2",
    "cordova-plugin-androidx-adapter": "^1.1.0",
    "cordova-plugin-browsertab": "^0.2.0",
    "cordova-plugin-buildinfo": "^4.0.0",
    "cordova-plugin-camera": "^4.1.0",
    "cordova-plugin-compat": "^1.2.0",
    "cordova-plugin-crop": "^0.4.0",
    "cordova-plugin-customurlscheme": "^5.0.1",
    "cordova-plugin-facebook4": "^6.4.0",
    "cordova-plugin-fcm-with-dependecy-updated": "^4.6.1",
    "cordova-plugin-file": "^6.0.2",
    "cordova-plugin-filepath": "^1.5.6",
    "cordova-plugin-firebasex": "^9.0.2-cli",
    "cordova-plugin-globalization": "^1.11.0",
    "cordova-plugin-googleplus": "8.4.0",
    "cordova-plugin-inappbrowser": "^3.2.0",
    "cordova-plugin-ionic-webview": "^4.1.3",
    "cordova-plugin-telerik-imagepicker": "^2.3.3",
    "cordova-sqlite-storage": "^5.0.0",
    "cordova-universal-links-plugin": "^1.2.1",
    "cordova-universal-links-plugin-fix": "^1.2.1",
    "core-js": "^2.6.10",
    "firebase": "^6.6.2",
    "ngx-clipboard": "^12.3.0",
    "promise-polyfill": "8.1.3",
    "rxjs": "^6.5.3",
    "tslib": "^1.9.0",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/architect": "~0.801.2",
    "@angular-devkit/build-angular": "^0.803.24",
    "@angular-devkit/core": "~8.1.2",
    "@angular-devkit/schematics": "~8.1.2",
    "@angular/cli": "~8.1.2",
    "@angular/compiler": "~8.1.2",
    "@angular/compiler-cli": "~8.1.2",
    "@angular/language-service": "~8.1.2",
    "@capacitor/cli": "1.2.1",
    "@ionic/angular-toolkit": "~2.0.0",
    "@types/jasmine": "~3.3.8",
    "@types/jasminewd2": "^2.0.8",
    "@types/node": "~8.9.4",
    "codelyzer": "^5.2.0",
    "cordova-plugin-device": "^2.0.3",
    "cordova-plugin-ionic-keyboard": "^2.2.0",
    "cordova-plugin-splashscreen": "^5.0.3",
    "cordova-plugin-statusbar": "^2.4.3",
    "cordova-plugin-whitelist": "^1.3.4",
    "jasmine-core": "~3.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "^4.4.1",
    "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",
    "node-sass": "^4.13.1",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.15.0",
    "typescript": "~3.4.3"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-camera": {
        "ANDROID_SUPPORT_V4_VERSION": "27.+"
      },
      "cordova-plugin-filepath": {},
      "cordova-plugin-telerik-imagepicker": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-keyboard": {},
      "cordova-plugin-globalization": {},
      "cordova-plugin-ionic-webview": {
        "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
      },
      "cordova-clipboard": {},
      "cordova-plugin-crop": {},
      "cordova-sqlite-storage": {},
      "cordova-plugin-file": {},
      "cordova-plugin-facebook4": {
        "APP_ID": "1...........6",
        "APP_NAME": "FamilyDelivery",
        "FACEBOOK_HYBRID_APP_EVENTS": "false",
        "FACEBOOK_ANDROID_SDK_VERSION": "5.13.0"
      },
      "cordova-plugin-buildinfo": {},
      "cordova-plugin-browsertab": {},
      "cordova-plugin-inappbrowser": {},
      "cordova-plugin-customurlscheme": {
        "URL_SCHEME": ".......@gmail.com",
        "ANDROID_SCHEME": " ",
        "ANDROID_HOST": " ",
        "ANDROID_PATHPREFIX": "/"
      },
      "cordova-plugin-googleplus": {
        "REVERSED_CLIENT_ID": ".........content.com",
        "PLAY_SERVICES_VERSION": "15.0.1"
      },
      "cordova-plugin-androidx": {},
      "cordova-plugin-androidx-adapter": {},
      "cordova-plugin-firebasex": {},
      "cordova-universal-links-plugin": {},
      "cordova-plugin-fcm-with-dependecy-updated": {
        "FCM_VERSION": "19.0.0",
        "GRADLE_TOOLS_VERSION": "3.5.3",
        "GOOGLE_SERVICES_VERSION": "4.3.3",
        "SUPPORT_LIBRARY_VERSION": "28.0.0",
        "ANDROID_DEFAULT_NOTIFICATION_ICON": "@mipmap/ic_launcher"
      }
    },
    "platforms": [
      "android"
    ]
  }
}
"@angular/core": "~8.1.2",

"@angular/fire": "^5.2.3",

"@angular/forms": "~8.1.2",

"@angular/platform-browser": "~8.1.2",

"@angular/platform-browser-dynamic": "~8.1.2",

"@angular/router": "~8.1.2",

"@capacitor/core": "1.2.1",

"@ionic-native/camera": "^5.16.0",

"@ionic-native/clipboard": "^5.22.0",

"@ionic-native/core": "^5.16.0",

"@ionic-native/crop": "^5.16.0",

"@ionic-native/facebook": "^5.23.0",

"@ionic-native/fcm": "^5.23.0",

"@ionic-native/file": "^5.23.0",

"@ionic-native/file-path": "^5.16.0",

"@ionic-native/firebase": "^5.22.0",

"@ionic-native/globalization": "^5.0.0",

"@ionic-native/google-plus": "^5.23.0",

"@ionic-native/image-picker": "^5.16.0",

"@ionic-native/ionic-webview": "^5.16.0",

"@ionic-native/splash-screen": "^5.16.0",

"@ionic-native/status-bar": "^5.16.0",

"@ionic/angular": "^4.11.5",

"@ionic/storage": "^2.2.0",

"@ngrx/effects": "^8.5.1",

"@ngrx/entity": "^8.5.1",

"@ngrx/store": "^8.5.1",

"@ngx-translate/core": "^12.1.2",

"@ngx-translate/http-loader": "^4.0.0",

"angularfire": "^2.3.0",

"cordova-android": "^8.1.0",

"cordova-clipboard": "^1.3.0",

"cordova-plugin-androidx": "^1.0.2",

"cordova-plugin-androidx-adapter": "^1.1.0",

"cordova-plugin-browsertab": "^0.2.0",

"cordova-plugin-buildinfo": "^4.0.0",

"cordova-plugin-camera": "^4.1.0",

"cordova-plugin-compat": "^1.2.0",

"cordova-plugin-crop": "^0.4.0",

"cordova-plugin-customurlscheme": "^5.0.1",

"cordova-plugin-facebook4": "^6.4.0",

"cordova-plugin-fcm-with-dependecy-updated": "^4.6.1",

"cordova-plugin-file": "^6.0.2",

"cordova-plugin-filepath": "^1.5.6",

"cordova-plugin-firebasex": "^9.0.2-cli",

"cordova-plugin-globalization": "^1.11.0",

"cordova-plugin-googleplus": "8.4.0",

"cordova-plugin-inappbrowser": "^3.2.0",

"cordova-plugin-ionic-webview": "^4.1.3",

"cordova-plugin-telerik-imagepicker": "^2.3.3",

"cordova-sqlite-storage": "^5.0.0",

"cordova-universal-links-plugin": "^1.2.1",

"cordova-universal-links-plugin-fix": "^1.2.1",

"core-js": "^2.6.10",

"firebase": "^6.6.2",

"ngx-clipboard": "^12.3.0",

"promise-polyfill": "8.1.3",

"rxjs": "^6.5.3",

"tslib": "^1.9.0",

"zone.js": "~0.9.1"

},

“devDependencies”: {

"@angular-devkit/architect": "~0.801.2",

"@angular-devkit/build-angular": "^0.803.24",

"@angular-devkit/core": "~8.1.2",

"@angular-devkit/schematics": "~8.1.2",

"@angular/cli": "~8.1.2",

"@angular/compiler": "~8.1.2",

"@angular/compiler-cli": "~8.1.2",

"@angular/language-service": "~8.1.2",

"@capacitor/cli": "1.2.1",

"@ionic/angular-toolkit": "~2.0.0",

"@types/jasmine": "~3.3.8",

"@types/jasminewd2": "^2.0.8",

"@types/node": "~8.9.4",

"codelyzer": "^5.2.0",

"cordova-plugin-device": "^2.0.3",

"cordova-plugin-ionic-keyboard": "^2.2.0",

"cordova-plugin-splashscreen": "^5.0.3",

"cordova-plugin-statusbar": "^2.4.3",

"cordova-plugin-whitelist": "^1.3.4",

"jasmine-core": "~3.4.0",

"jasmine-spec-reporter": "~4.2.1",

"karma": "^4.4.1",

"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",

"node-sass": "^4.13.1",

"protractor": "~5.4.0",

"ts-node": "~7.0.0",

"tslint": "~5.15.0",

"typescript": "~3.4.3"

},

“description”: “An Ionic project”,

“cordova”: {

"plugins": {

  "cordova-plugin-camera": {

    "ANDROID_SUPPORT_V4_VERSION": "27.+"

  },

  "cordova-plugin-filepath": {},

  "cordova-plugin-telerik-imagepicker": {},

  "cordova-plugin-whitelist": {},

  "cordova-plugin-statusbar": {},

  "cordova-plugin-device": {},

  "cordova-plugin-splashscreen": {},

  "cordova-plugin-ionic-keyboard": {},

  "cordova-plugin-globalization": {},

  "cordova-plugin-ionic-webview": {

    "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"

  },

  "cordova-clipboard": {},

  "cordova-plugin-crop": {},

  "cordova-sqlite-storage": {},

  "cordova-plugin-file": {},

  "cordova-plugin-facebook4": {

    "APP_ID": "1145978773456127",

    "APP_NAME": "The-Family-Delivery",

    "FACEBOOK_HYBRID_APP_EVENTS": "false",

    "FACEBOOK_ANDROID_SDK_VERSION": "5.13.0"

  },

  "cordova-plugin-buildinfo": {},

  "cordova-plugin-browsertab": {},

  "cordova-plugin-inappbrowser": {},

  "cordova-plugin-customurlscheme": {

    "URL_SCHEME": "........", // here email

    "ANDROID_SCHEME": " ",

    "ANDROID_HOST": " ",

    "ANDROID_PATHPREFIX": "/"

  },

  "cordova-plugin-googleplus": {

    "REVERSED_CLIENT_ID": ".........", //here the id

    "PLAY_SERVICES_VERSION": "15.0.1"

  },

  "cordova-plugin-fcm-with-dependecy-updated": {

    "FCM_VERSION": "19.0.0",

    "GRADLE_TOOLS_VERSION": "3.5.3",

    "GOOGLE_SERVICES_VERSION": "4.3.3",

    "SUPPORT_LIBRARY_VERSION": "28.0.0",

    "ANDROID_DEFAULT_NOTIFICATION_ICON": "@mipmap/ic_launcher"

  },

  "cordova-plugin-androidx": {},

  "cordova-plugin-androidx-adapter": {},

  "cordova-plugin-firebasex": {},

  "cordova-universal-links-plugin": {}

},

"platforms": [

  "android"

]

}

}

I have tried this solution: here, but curl command is returning 400: Invalid request. But I have the google-services.ts file in the root of my project and another copy of it in the platforms/android folder
I am new to ionic. Please show me a step by step solution to follow.
Thank u in advance.

Please try this Plugin for all the FCM related Stuff: https://ionicframework.com/docs/native/firebase-x

Thanks @EinfachHans
I have followed the mentioned steps in the given link, started from the project that i havent added fcm to. now the same error:
It seems to be a dependency error, but i dont know where is it or how to fix.

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine the dependencies of task ‘:app:compileDebugJavaWithJavac’.

Could not resolve all task dependencies for configuration ‘:app:debugCompileClasspath’.
Could not resolve com.google.android.gms:play-services-base:[15.0.1,16.0.0).
Required by:
project :app > com.google.android.gms:play-services-identity:15.0.1
Failed to list versions for com.google.android.gms:play-services-base.
Unable to load Maven meta-data from https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-base/maven-metadata.xml.
Could not HEAD ‘https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-base/maven-metadata.xml’.
dl.google.com

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 34s
E:\Projects\DeliveryFamily-4-4-2020 - FirebaseX\platforms\android\gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine the dependencies of task ‘:app:compileDebugJavaWithJavac’.

Could not resolve all task dependencies for configuration ‘:app:debugCompileClasspath’.
Could not resolve com.google.android.gms:play-services-base:[15.0.1,16.0.0).
Required by:
project :app > com.google.android.gms:play-services-identity:15.0.1
Failed to list versions for com.google.android.gms:play-services-base.
Unable to load Maven meta-data from https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-base/maven-metadata.xml.
Could not HEAD ‘https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-base/maven-metadata.xml’.
dl.google.com

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 34s
[ERROR] An error occurred while running subprocess cordova.

    cordova.cmd build android exited with exit code 1.

After adding firebasex, the same error.
Then I fixed it as follows:

  1. ionic repare.
  2. set minsdkversion to 21 (the idea is to enable multidex)
1 Like