Can't get app to build that uses cordova and firebase

I am going round and round in circles here, no mater what i do, i fix one issue and then another comes up. I just can’t build this app into android apk when using the ionic/cordova firebase plugins.

Now i am getting this cryptic error:

BUILD FAILED in 20s
/Volumes/Work/green-water-services/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ‘:app’.

groovy.lang.MissingMethodException: No signature of method: org.gradle.api.internal.model.DefaultObjectFactory.directoryProperty() is applicable for argument types: () values:

  • 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

NOTE: I am using the cordova-plugin-firebasex plugin as an attempt to get it built as cordova-plugin-firebase produces a totall different error, i get this when using cordova-plugin-firebase:

BUILD FAILED in 12s
/Volumes/Work/green-water-services/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

  • What went wrong:
    Failed to capture fingerprint of input files for task ‘:app:preDebugBuild’ property ‘compileManifests’ during up-to-date check.

The library com.google.android.gms:play-services-measurement-base is being requested by various other libraries at [[20.0.1,20.0.1], [20.0.2,20.0.2]], but resolves to 20.0.2. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.

It looks like a method is missing with gradle?? Why? ionic / cordova is a joke honestly. I have absolutely no idea how i’m supposed to build this app when everything i do just causes errors. I’m even having to add the platform android@8.0.0 as 9 again produces errors!

Here is my package.json

{
  "name": "green-water-services",
  "version": "0.0.1",
  "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": "^11.2.14",
    "@angular/core": "^11.2.14",
    "@angular/fire": "^6.1.5",
    "@angular/forms": "^11.2.14",
    "@angular/platform-browser": "^11.2.14",
    "@angular/platform-browser-dynamic": "^11.2.14",
    "@angular/router": "^11.2.14",
    "@ionic-native/ble": "^5.6.11",
    "@ionic-native/bluetooth-serial": "^5.6.11",
    "@ionic-native/camera": "^5.6.11",
    "@ionic-native/core": "^5.6.11",
    "@ionic-native/firebase": "^5.6.11",
    "@ionic/angular": "^5.6.11",
    "@ionic/app-scripts": "^3.2.4",
    "cordova-plugin-bluetooth-serial": "^0.4.7",
    "firebase": "^8.6.8",
    "ionic": "^5.4.16",
    "ionicons": "^5.5.2",
    "npm": "^8.3.0",
    "rxjs": "~6.6.0",
    "rxjs-compat": "^6.6.7",
    "signature_pad": "^4.0.1",
    "tslib": "^2.3.0",
    "typescript": "4.1.6",
    "zone.js": "^0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^12.1.0",
    "@angular-eslint/builder": "2.0.2",
    "@angular-eslint/eslint-plugin": "2.0.2",
    "@angular-eslint/eslint-plugin-template": "2.0.2",
    "@angular-eslint/template-parser": "2.0.2",
    "@angular/cli": "11.2.14",
    "@angular/compiler": "^11.2.14",
    "@angular/compiler-cli": "^11.2.14",
    "@angular/language-service": "^11.2.14",
    "@ionic/angular-toolkit": "^3.1.1",
    "@types/jasmine": "^3.7.7",
    "@types/jasminewd2": "^2.0.9",
    "@types/node": "^12.20.15",
    "@typescript-eslint/eslint-plugin": "4.16.1",
    "@typescript-eslint/parser": "4.16.1",
    "cordova-android": "^8.0.0",
    "cordova-plugin-ble-central": "^1.3.1",
    "cordova-plugin-camera": "^5.0.2",
    "cordova-plugin-device": "^2.0.3",
    "cordova-plugin-firebasex": "github:dpa99c/cordova-plugin-firebasex",
    "cordova-plugin-ionic-keyboard": "^2.2.0",
    "cordova-plugin-ionic-webview": "^4.2.1",
    "cordova-plugin-splashscreen": "^5.0.4",
    "cordova-plugin-statusbar": "^2.4.3",
    "cordova-plugin-whitelist": "^1.3.5",
    "eslint": "^7.29.0",
    "eslint-plugin-import": "2.22.1",
    "eslint-plugin-jsdoc": "30.7.6",
    "eslint-plugin-prefer-arrow": "1.2.2",
    "firebase-tools": "^9.14.0",
    "jasmine-core": "~3.6.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "^6.3.4",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.0.3",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.6.0",
    "postcss": "^8.4.5",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-bluetooth-serial": {},
      "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-ble-central": {
        "ACCESS_BACKGROUND_LOCATION": "false"
      },
      "cordova-plugin-camera": {
        "ANDROID_SUPPORT_V4_VERSION": "27.+"
      },
      "cordova-plugin-firebasex": {}
    },
    "platforms": [
      "android"
    ]
  }
}

EDIT

I managed to get a build with android@9.0.0 by changing some plugins, here is my new package.json - even though this built, the apk just crashes on the emulator! Can’t even see an error output because it simply opens and crashes so i can’t use the chrome inspector.

{
  "name": "green-water-services",
  "version": "0.0.1",
  "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": "^11.2.14",
    "@angular/core": "^11.2.14",
    "@angular/fire": "^6.1.5",
    "@angular/forms": "^11.2.14",
    "@angular/platform-browser": "^11.2.14",
    "@angular/platform-browser-dynamic": "^11.2.14",
    "@angular/router": "^11.2.14",
    "@ionic-native/ble": "^5.6.11",
    "@ionic-native/bluetooth-serial": "^5.6.11",
    "@ionic-native/camera": "^5.6.11",
    "@ionic-native/core": "^5.6.11",
    "@ionic-native/firebase": "^5.6.11",
    "@ionic/angular": "^5.6.11",
    "@ionic/app-scripts": "^3.2.4",
    "cordova-plugin-bluetooth-serial": "^0.4.7",
    "firebase": "^8.6.8",
    "ionic": "^5.4.16",
    "ionicons": "^5.5.2",
    "npm": "^8.3.0",
    "rxjs": "~6.6.0",
    "rxjs-compat": "^6.6.7",
    "signature_pad": "^4.0.1",
    "tslib": "^2.3.0",
    "typescript": "4.1.6",
    "zone.js": "^0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^12.1.0",
    "@angular-eslint/builder": "2.0.2",
    "@angular-eslint/eslint-plugin": "2.0.2",
    "@angular-eslint/eslint-plugin-template": "2.0.2",
    "@angular-eslint/template-parser": "2.0.2",
    "@angular/cli": "11.2.14",
    "@angular/compiler": "^11.2.14",
    "@angular/compiler-cli": "^11.2.14",
    "@angular/language-service": "^11.2.14",
    "@ionic/angular-toolkit": "^3.1.1",
    "@types/jasmine": "^3.7.7",
    "@types/jasminewd2": "^2.0.9",
    "@types/node": "^12.20.15",
    "@typescript-eslint/eslint-plugin": "4.16.1",
    "@typescript-eslint/parser": "4.16.1",
    "cordova-android": "^9.0.0",
    "cordova-plugin-androidx": "^3.0.0",
    "cordova-plugin-androidx-adapter": "^1.1.3",
    "cordova-plugin-ble-central": "^1.3.1",
    "cordova-plugin-camera": "^5.0.2",
    "cordova-plugin-device": "^2.0.3",
    "cordova-plugin-firebasex": "github:dpa99c/cordova-plugin-firebasex",
    "cordova-plugin-ionic-keyboard": "^2.2.0",
    "cordova-plugin-ionic-webview": "^4.2.1",
    "cordova-plugin-splashscreen": "^5.0.4",
    "cordova-plugin-statusbar": "^2.4.3",
    "cordova-plugin-whitelist": "^1.3.5",
    "eslint": "^7.29.0",
    "eslint-plugin-import": "2.22.1",
    "eslint-plugin-jsdoc": "30.7.6",
    "eslint-plugin-prefer-arrow": "1.2.2",
    "firebase-tools": "^9.14.0",
    "jasmine-core": "~3.6.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "^6.3.4",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.0.3",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.6.0",
    "postcss": "^8.4.5",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-bluetooth-serial": {},
      "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-ble-central": {
        "ACCESS_BACKGROUND_LOCATION": "false"
      },
      "cordova-plugin-camera": {
        "ANDROID_SUPPORT_V4_VERSION": "27.+"
      },
      "cordova-plugin-firebasex": {},
      "cordova-plugin-androidx": {},
      "cordova-plugin-androidx-adapter": {}
    },
    "platforms": [
      "android"
    ]
  }
}