Android Build Failing

From last two days I have been trying to build ionic for android, however I have started getting build error on mac.

FAILURE: Build failed with an exception.

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

Could not resolve all files for configuration ‘:classpath’.
Could not resolve com.google.gms:google-services:4.1.0.
Required by:
project :
Could not resolve com.google.gms:google-services:4.1.0.
Could not get resource ‘https://maven.google.com/com/google/gms/google-services/4.1.0/google-services-4.1.0.pom’.
Could not GET ‘https://maven.google.com/com/google/gms/google-services/4.1.0/google-services-4.1.0.pom’.
sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Could not resolve com.google.gms:google-services:4.1.0.
Could not get resource ‘https://jcenter.bintray.com/com/google/gms/google-services/4.1.0/google-services-4.1.0.pom’.
Could not GET ‘https://jcenter.bintray.com/com/google/gms/google-services/4.1.0/google-services-4.1.0.pom’.
sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Could not resolve com.google.gms:google-services:4.1.0.
Could not get resource ‘https://maven.fabric.io/public/com/google/gms/google-services/4.1.0/google-services-4.1.0.pom’.
Could not GET ‘https://maven.fabric.io/public/com/google/gms/google-services/4.1.0/google-services-4.1.0.pom’.
sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Could not resolve io.fabric.tools:gradle:1.25.4.
Required by:
project :
Could not resolve io.fabric.tools:gradle:1.25.4.
Could not get resource ‘https://maven.google.com/io/fabric/tools/gradle/1.25.4/gradle-1.25.4.pom’.
Could not GET ‘https://maven.google.com/io/fabric/tools/gradle/1.25.4/gradle-1.25.4.pom’.
sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Could not resolve io.fabric.tools:gradle:1.25.4.
Could not get resource ‘https://jcenter.bintray.com/io/fabric/tools/gradle/1.25.4/gradle-1.25.4.pom’.
Could not GET ‘https://jcenter.bintray.com/io/fabric/tools/gradle/1.25.4/gradle-1.25.4.pom’.
sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Could not resolve io.fabric.tools:gradle:1.25.4.
Could not get resource ‘https://maven.fabric.io/public/io/fabric/tools/gradle/1.25.4/gradle-1.25.4.pom’.
Could not GET ‘https://maven.fabric.io/public/io/fabric/tools/gradle/1.25.4/gradle-1.25.4.pom’.
sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

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

I have all certificates added in cacerts for java, still getting this issue.

Ionic Information

Ionic:

ionic (Ionic CLI) : 4.10.1 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.1

Cordova:

cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : android 7.1.4
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.1, (and 5 other plugins)

System:

Android SDK Tools : 26.1.1 (/Users/nitindig/Library/Android/sdk)
ios-deploy : 1.5.0
ios-sim : 3.1.1
NodeJS : v8.11.3 (/usr/local/bin/node)
npm : 6.4.1
OS : macOS Mojave
Xcode : Xcode 10.1 Build version 10B61

Hello, did you find any solution to this?