Build failing

Hi, my project was working fine some days ago but now when I try to build it I am getting the following errors. Have to say that we are team so I am not sure if it’s someone who fked up. This is my output when trying to build for android:

:compileDebugJavaWithJavac

:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
C:\a\platforms\android\src\com\ionicframework\common\IonicCordovaCommon.java:72: error: strings in switch are not supported in
-source 1.6
    switch(action) {
          ^
  (use -source 7 or higher to enable strings in switch)
C:\a\platforms\android\src\com\ionicframework\common\IonicCordovaCommon.java:144: error: cannot find symbol

    SharedPreferences prefs = this.cordova.getContext().getSharedPreferences("com.ionic.deploy.preferences", Context.MODE_PRIVATE);
                                          ^
  symbol:   method getContext()
  location: variable cordova of type CordovaInterface
C:\a\platforms\android\src\com\ionicframework\common\IonicCordovaCommon.java:201: error: cannot find symbol
    SharedPreferences prefs = this.cordova.getContext().getSharedPreferences("com.ionic.deploy.preferences", Context.MODE_PRIVATE);
                                          ^
  symbol:   method getContext()
  location: variable cordova of type CordovaInterface
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.
3 errors
:compileDebugJavaWithJavac
FAILED

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.

BUILD FAILED

Total time: 25.731 secs
(node:1620) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
C:\a\platforms\android\src\com\ionicframework\common\IonicCordovaCommon.java:72: error: strings in switch are not supported in
-source 1.6
    switch(action) {
          ^
  (use -source 7 or higher to enable strings in switch)
C:\a\platforms\android\src\com\ionicframework\common\IonicCordovaCommon.java:144: error: cannot find symbol
    SharedPreferences prefs = this.cordova.getContext().getSharedPreferences("com.ionic.deploy.preferences", Context.MODE_PRIVATE);
                                          ^
  symbol:   method getContext()
  location: variable cordova of type CordovaInterface
C:\a\platforms\android\src\com\ionicframework\common\IonicCordovaCommon.java:201: error: cannot find symbol
    SharedPreferences prefs = this.cordova.getContext().getSharedPreferences("com.ionic.deploy.preferences", Context.MODE_PRIVATE);
                                          ^
  symbol:   method getContext()
  location: variable cordova of type CordovaInterface
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.
3 errors

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.
    at ChildProcess.whenDone (C:\a\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
(node:1620) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1620) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

My Ionic info is:

cli packages: (C:\Users\UsuarioDT01\AppData\Roaming\npm\node_modules)

    @ionic/cli-plugin-proxy : 1.5.8
    @ionic/cli-utils        : 1.19.2
    ionic (Ionic CLI)       : 3.20.0

global packages:

    cordova (Cordova CLI) : 8.0.0

local packages:

    @ionic/app-scripts : 3.1.10
    Cordova Platforms  : android 6.3.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.1.1
    Node              : v8.11.1
    npm               : 5.6.0
    OS                : Windows 10

Environment Variables:

    ANDROID_HOME     : C:\Users\UsuarioDT01\AppData\Local\Android\Sdk
    HTTP_PROXY       : not set
    http_proxy       : not set
    HTTPS_PROXY      : not set
    https_proxy      : not set
    IONIC_HTTP_PROXY : not set
    PROXY            : not set
    proxy            : not set

Misc:

    backend : pro

Please help, this is urgent

Thanks!

1 Like

try this commands:
cordova clean
cordova build

then try again and tell me

Same error when doing cordova build

Try to remove platform and add again

the problem is with android 6.3.0, if I use 7.0.0 it seems to work. But I don’t understand why, it was working before.

Cordova Platforms : android 6.3.0

Here your ionic-info says android 6.3.0 may be one of ur team member has compiled with 7.0.0 So you have to upgrade your android version else remove platform and try to add

ionic cordova platform add android@6.3.0

1 Like

Yes, I removed the current Android version and added the 7 one hope this won’t break anything on the app LOL

1 Like