0
votes

I am trying to use the fcm plugin as described here, just after installation, I now cannot build for Android. I think it is a problem with dependencies, I have tried everything on Stack Overflow and on the Ionic forum, posted my problem there also.

I am an Ionic beginner.

Error is:

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
         > 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.

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

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

My dependencies are:

"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": "1400.....416",
        "APP_NAME": "F.....ry",
        "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": "[email protected]",
        "ANDROID_SCHEME": " ",
        "ANDROID_HOST": " ",
        "ANDROID_PATHPREFIX": "/"
      },
      "cordova-plugin-googleplus": {
        "REVERSED_CLIENT_ID": "5220........nt.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"
    ]
  }
}

ionic info:

Ionic:

Ionic CLI : 6.3.0 (C:\Users\user\AppData\Roaming\npm\node_modules@ionic\cli) Ionic Framework : @ionic/angular 4.11.5
@angular-devkit/build-angular : 0.803.24 @angular-devkit/schematics : 8.1.3 @angular/cli : 8.1.3
@ionic/angular-toolkit : 2.0.0

Capacitor:

Capacitor CLI : 1.2.1 @capacitor/core : 1.2.1

Cordova:

Cordova CLI : 9.0.0 ([email protected]) Cordova Platforms : android 8.1.0 Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 22 other plugins)

Utility:

cordova-res : 0.10.0 native-run : 0.3.0

System:

NodeJS : v12.16.1 (C:\Program Files\nodejs\node.exe) npm : 6.13.4 OS : Windows 10

1

1 Answers

2
votes

Notice: I have removed fcm plugin and used firebasex, but having the same error, then i solved it following these steps:

  1. command: ionic repare

  2. I have enabled multidex by just setting minsdkversion to 21 (you can enable it in other methods if min SDK required is less than what I mentioned). Then tried for ionic cordova plugin cordova-plugin-fcm-with-dependecy-updated and worked :)