BUILD FAILED with Gradle issue

I’m trying to build the project with cordova build android but it gets failed with “Failed to apply plugin [id ‘com.android.application’]”

Minimum supported Gradle version is 5.1.1. Current version is 4.10.3. If using the gradle wrapper, try editing the distributionUrl in ~/ProjectName/gradle/wrapper/gradle-wrapper.properties to gradle-5.1.1-all.zip

I have updated gradle version and changed in gradle-wrapper.properties file but after running cordova build android command all changes revert and gave me BUILD FAILED error.

Please help me to resolve this issue.

Thanks.

1.First Option download Gradle version 5.1.1 or 4.10.3 and in distribution url give path of gradle file so when it starts for build it checks on that path and once found it will build app.

OR

2.When you are downloading gradle check firewall and network because sometimes in corporate proxy giving problem to download

Thank you, I have updated Gradle Version but now new issue comes,

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not resolve all files for configuration ‘:app:debugCompileClasspath’.

Could not find any version that matches com.google.android.gms:strict-version-matcher-plugin:[15.0.0, 16.0.0).
Versions that do not match:
- 1.2.0
- 1.1.0
- 1.0.3
- 1.0.2
- 1.0.1
- + 1 more
Required by:
project :app > com.google.gms:google-services:4.3.0

  • 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 52s
3 actionable tasks: 1 executed, 2 up-to-date

will this help you?

Build Failed issue comes because of OneSignal plugin. So I followed this steps and it worked.