katzer / cordova-plugin-background-mode

Keep app running in background
Apache License 2.0
1.38k stars 1k forks source link

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

Open sunilk44 opened 4 years ago

sunilk44 commented 4 years ago

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.

mirko77 commented 4 years ago

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

mbilbao commented 4 years ago

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??

mirko77 commented 4 years ago

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

mbilbao commented 4 years ago

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

mirko77 commented 4 years ago

Do a cordova clean and rebuild

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

daveshirman commented 4 years ago

Any solution to this?

DhruvSakhiya commented 3 years ago

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

coderbuzz commented 1 year ago

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