Cordova Android 11 Build Error


I have upgraded cordova-android of my ionic 6 project from 10.1.2 to 11.0.0 using below commands as shown in this cordova’s official blog.

cordova platform remove android
cordova platform add android@11.0.0

Both commands ran without any error. But if I build my project now I am getting the below error:

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
* Where:
Script 'D:\project\@Codes Repos\Ionic6-cordova - Copy\platforms\android\cordova-plugin-code-push\projecttest-build-extras.gradle' line: 66

* What went wrong:
A problem occurred evaluating script.
> Could not find method compile() for arguments [com.nimbusds:nimbus-jose-jwt:5.1, projecttest_build_extras_5yckz03x3pcqc3cg9p6fyikbd$_run_closure3$_closure8@751df0bf] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

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

2: Task failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> compileSdkVersion is not specified. Please add it to build.gradle

* 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.


Command failed with exit code 1: D:\project\@Codes Repos\Ionic6-cordova - Copy\platforms\android\gradlew cdvBuildDebug -b D:\project\@Codes Repos\Ionic6-cordova - Copy\platforms\android\build.gradle
[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.

Ionic info


   Ionic CLI                     : 6.19.0 (C:\Users\CGauns\AppData\Roaming\nvm\v16.15.0\node_modules\@ionic\cli)
   Ionic Framework               : @ionic/angular 6.1.10
   @angular-devkit/build-angular : 13.2.6
   @angular-devkit/schematics    : 13.2.6
   @angular/cli                  : 13.2.6
   @ionic/angular-toolkit        : 6.1.0


   Cordova CLI       : 11.0.0
   Cordova Platforms : android 11.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 23 other plugins)


   cordova-res                          : 0.15.4
   native-run (update available: 1.6.0) : 1.5.0


   Android SDK Tools : 26.1.1 (D:\Android\sdk)
   NodeJS            : v16.15.0 (C:\Program Files\nodejs\node.exe)
   npm               : 8.5.5
   OS                : Windows 10

JDK : jdk-11.0.15
Gradle: 7.4.2

Ok. Issue resolved after removing code push plugin

Command: cordova plugin remove cordova-plugin-code-push

the plugin is using compile keyword which was deprecated long ago and removed on gradle 7, which cordova-android uses

The plugin is archived, so yeah, best thing is to remove it as it’s not being maintained anymore

1 Like