Error building with ionic cordova

I am having problems build an ionic project as it fails with a gradle error each time I try to build the project for Android. I couldnt get it to work on my main project, so I created a new one from blank and still get the same error.
I have tried running it with --verbose and this is the output.

  • Where:
    Build file ‘D:\Source\ClubApp\ClubApp\platforms\android\app\build.gradle’ line: 20

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

Failed to apply plugin [id ‘com.android.application’]
Could not create plugin of type ‘AppPlugin’.
Could not initialize class com.android.build.gradle.AppPlugin

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

The build.gradle contents is

buildscript {
repositories {
google()
jcenter()
}

dependencies {
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files

    classpath 'com.android.tools.build:gradle:3.3.0'
}

}

allprojects {
repositories {
google()
jcenter()
}

//This replaces project.properties w.r.t. build settings
project.ext {
  defaultBuildToolsVersion="28.0.3" //String
  defaultMinSdkVersion=19 //Integer - Minimum requirement is Android 4.4
  defaultTargetSdkVersion=28 //Integer - We ALWAYS target the latest by default
  defaultCompileSdkVersion=28 //Integer - We ALWAYS compile with the latest by default
}

}

task clean(type: Delete) {
delete rootProject.buildDir
}