Issue while generating apk

I am able to run application and seems fine with “ionic serve” but when generating apk giving following wrror,

 cordova.cmd build android
cordova-plugin-androidx-adapter: Processed 48 Java source files in 1152ms
Preparing Firebase on Android
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=D:\Software\AndroidSDK (DEPRECATED)
Starting a Gradle Daemon, 1 incompatible and 4 stopped Daemons could not be reused, use --status for details
:wrapper

BUILD SUCCESSFUL in 32s
1 actionable task: 1 executed
Subproject Path: CordovaLib
Subproject Path: app
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details

Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.

FAILURE: Build failed with an exception.

* Where:
Build file 'E:\Edify Now\Other Repo\IR Mobile App_Third_Instance\platforms\android\app\build.gradle' line: 93

* What went wrong:
A problem occurred evaluating project ':app'.
> Could not resolve all artifacts for configuration 'classpath'.
   > Could not find com.google.android.gms:strict-version-matcher-plugin:1.1.0.
     Searched in the following locations:
       - https://jcenter.bintray.com/com/google/android/gms/strict-version-matcher-plugin/1.1.0/strict-version-matcher-plugin-1.1.0.pom
       - https://jcenter.bintray.com/com/google/android/gms/strict-version-matcher-plugin/1.1.0/strict-version-matcher-plugin-1.1.0.jar
       - https://repo.maven.apache.org/maven2/com/google/android/gms/strict-version-matcher-plugin/1.1.0/strict-version-matcher-plugin-1.1.0.pom
       - https://repo.maven.apache.org/maven2/com/google/android/gms/strict-version-matcher-plugin/1.1.0/strict-version-matcher-plugin-1.1.0.jar
     Required by:
         unspecified:unspecified:unspecified > com.google.gms:google-services:4.2.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 1m 23s
> Configure project :app
E:\Edify Now\Other Repo\IR Mobile App_Third_Instance\platforms\android\gradlew: Command failed with exit code 1 Error output:
Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.

FAILURE: Build failed with an exception.

* Where:
Build file 'E:\Edify Now\Other Repo\IR Mobile App_Third_Instance\platforms\android\app\build.gradle' line: 93

* What went wrong:
A problem occurred evaluating project ':app'.
> Could not resolve all artifacts for configuration 'classpath'.
   > Could not find com.google.android.gms:strict-version-matcher-plugin:1.1.0.
     Searched in the following locations:
       - https://jcenter.bintray.com/com/google/android/gms/strict-version-matcher-plugin/1.1.0/strict-version-matcher-plugin-1.1.0.pom
       - https://jcenter.bintray.com/com/google/android/gms/strict-version-matcher-plugin/1.1.0/strict-version-matcher-plugin-1.1.0.jar
       - https://repo.maven.apache.org/maven2/com/google/android/gms/strict-version-matcher-plugin/1.1.0/strict-version-matcher-plugin-1.1.0.pom
       - https://repo.maven.apache.org/maven2/com/google/android/gms/strict-version-matcher-plugin/1.1.0/strict-version-matcher-plugin-1.1.0.jar
     Required by:
         unspecified:unspecified:unspecified > com.google.gms:google-services:4.2.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 1m 23s
[ERROR] An error occurred while running subprocess cordova.

        cordova.cmd build android exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.

I am not able to find solution for this. My project configuration is,

Ionic:

   Ionic CLI          : 5.1.0 (C:\Users\Admin\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.3

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : android 8.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.1, (and 17 other plugins)

Utility:

   cordova-res : not installed
   native-run  : 0.2.3

System:

   Android SDK Tools : 26.1.1 (D:\Software\AndroidSDK)
   NodeJS            : v10.16.0 (C:\Program Files (x86)\nodejs\node.exe)
   npm               : 6.9.0
   OS                : Windows 10

Please suggest me the solution.

Thanks,
Nilesh

1 Like