Page 1 of 1

Android Build Error with Background Mode

Posted: Wed Feb 13, 2019 9:41 am
by Deon

Hi
I am trying to use the katzer Background Mode Plugin as recommended by Appery. I get the following APK build error

Build error

Most likely build error cause:

/app/platforms/android/src/de/appplant/cordova/plugin/background/BackgroundMode.java:295: error: lambda expressions are not supported in -source 1.6
cordova.getActivity().runOnUiThread(() - webView.loadUrl("javascript:" + js));
^
(use -source 8 or higher to enable lambda expressions)
/app/platforms/android/src/de/appplant/cordova/plugin/background/BackgroundModeExt.java:168: error: lambda expressions are not supported in -source 1.6
getApp().runOnUiThread(() - {
^
(use -source 8 or higher to enable lambda expressions)
/app/platforms/android/src/de/appplant/cordova/plugin/background/BackgroundModeExt.java:257: error: method references are not supported in -source 1.6
activity.runOnUiThread(dialog::show);
^
(use -source 8 or higher to enable method references)
3 errors
:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.
(node:3488) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: /app/platforms/android/gradlew: 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.
/app/platforms/android/src/de/appplant/cordova/plugin/background/BackgroundMode.java:295: error: lambda expressions are not supported in -source 1.6
cordova.getActivity().runOnUiThread(() - webView.loadUrl("javascript:" + js));
^
(use -source 8 or higher to enable lambda expressions)
/app/platforms/android/src/de/appplant/cordova/plugin/background/BackgroundModeExt.java:168: error: lambda expressions are not supported in -source 1.6
getApp().runOnUiThread(() - {
^
(use -source 8 or higher to enable lambda expressions)
/app/platforms/android/src/de/appplant/cordova/plugin/background/BackgroundModeExt.java:257: error: method references are not supported in -source 1.6
activity.runOnUiThread(dialog::show);
^
(use -source 8 or higher to enable method references)
3 errors

FAILURE: Build failed with an exception.


Android Build Error with Background Mode

Posted: Thu Feb 14, 2019 9:37 am
by Serhii Kulibaba

Hello Deon,

It seems you use the version of that plugin, based on ES6, but Appery.io supports ES5. Please check the previous version of that plugin.