"ionic cordova build android" Error

I’m receiving this error whenever I’m building the app for android.

BUILD FAILED

        Total time: 47.188 secs
        Error: cmd: Command failed with exit code 1 Error output:
        C:\[APP_PATH]\platforms\android\src\com\synconset\cordovahttp\CordovaHttpPlugin.java:68:
        error: constructor CordovaHttpPatch in class CordovaHttpPatch cannot be applied to given types;
                     CordovaHttpPatch patch = new CordovaHttpPatch(urlString, params, serializerName, headers,
        callbackContext);
                                              ^
           required: String,JSONObject,String,JSONObject,CallbackContext,int
           found: String,JSONObject,String,JSONObject,CallbackContext
           reason: actual and formal argument lists differ in length
        Note: Some input files use or override a deprecated API.
        Note: Recompile with -Xlint:deprecation for details.
        Note: Some input files use unchecked or unsafe operations.
        Note: Recompile with -Xlint:unchecked for details.
        1 error

        FAILURE: Build failed with an exception.

        * What went wrong:
        Execution failed for task ':compileDebugJavaWithJavac'.
        > Compilation failed; see the compiler error output for details.

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

Here is my ionic info:

cli packages: (C:\[USER_PATH]\AppData\Roaming\npm\node_modules)

    @ionic/cli-utils  : 1.12.0
    ionic (Ionic CLI) : 3.12.0

global packages:

    cordova (Cordova CLI) : 7.0.1

local packages:

    @ionic/app-scripts : 2.1.4
    Cordova Platforms  : android 6.2.3
    Ionic Framework    : ionic-angular 3.6.1

System:

    Node : v8.4.0
    npm  : 5.3.0
    OS   : Windows 10

Misc:

    backend : pro

My plugins:


cordova-plugin-advanced-http 1.5.10 "Advanced HTTP plugin"
cordova-plugin-compat 1.0.0 "Compat"
cordova-plugin-console 1.0.5 "Console"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-file 4.3.3 "File"
cordova-plugin-googlemaps 2.0.11 "cordova-plugin-googlemaps"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-statusbar 2.2.2 "StatusBar"
cordova-plugin-whitelist 1.3.1 "Whitelist"
ionic-plugin-keyboard 2.2.1 "Keyboard"

What could be the possible reason/s for this error?

try this

  1. ionic platform remove android
  2. ionic platform add android

Hi thanks for the reply. I already do that many times but the error still occurs.

Also, it is ionic cordova platform add/remove android.

Any updates? I have experiencing the exact same error and haven’t found a solution.

Hi, I just created a new project and it works fine now.

Yeah, I had to move everything from Windows to a Mac and it worked fine after I did that. Very unfortunate.