cordova-plugin-background-mode icon indicating copy to clipboard operation
cordova-plugin-background-mode copied to clipboard

Build Failed (use -source 8 or higher to enable lambda expressions)

Open sunilk44 opened this issue 6 years ago • 8 comments

After installing the plugin build failed due to (use -source 8 or higher to enable lambda expressions) ../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)

../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)

../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) can you suggest me solution for resolveing this issue.

sunilk44 avatar Nov 09 '19 10:11 sunilk44

You have to build the app with Java 8 (1.8)

mirko77 avatar Dec 04 '19 12:12 mirko77

I face the same issue and I already have Java 1.8. Is there any way to force to compile this part with java 1.8??

mbilbao avatar Dec 04 '19 13:12 mbilbao

@mbilbao I did that in Android Studio, setting 1.8 as both target and source compatibility.

mirko77 avatar Dec 04 '19 13:12 mirko77

Yes, I did the same, but somehow it managed to keep compiling that part in 1.7

mbilbao avatar Dec 05 '19 12:12 mbilbao

Do a cordova clean and rebuild

Also, look at your grade files, maybe you have some reference to 1.7 still there

mirko77 avatar Dec 05 '19 13:12 mirko77

Any solution to this?

daveshirman avatar Mar 13 '20 16:03 daveshirman

i am also having same error how to solve it any tips ?

DhruvSakhiya avatar Sep 25 '20 06:09 DhruvSakhiya

We have thousand devices which target API 17, what release version that support API 17?

coderbuzz avatar Aug 19 '22 08:08 coderbuzz