java - intellij with Android SDK : lambda expressions are not supported in -source 1.7 -
good day all
i know there various questions on issue, , have visited quite number of them, not provide "solution".
the general answer set language level 8 (allowing lambdas) have done 2 modules built grade, see below
and
i confirm have java 8 install
java -version java version "1.8.0_141" java(tm) se runtime environment (build 1.8.0_141-b15) java hotspot(tm) 64-bit server vm (build 25.141-b15, mixed mode)
when setting language level, resolves issue has in ide,but when building project run on devvice, error:
information:gradle tasks [:app:assembledebug] /home/cybex/documents/university/year 5/semester 2/wrap302 - advanced programming 2/assignments/assignment1/task1_sos2/app/src/main/java/wrap302/nmu/task1_sos/sosbutton.java error:(15, 25) error: lambda expressions not supported in -source 1.7 (use -source 8 or higher enable lambda expressions) /home/cybex/documents/university/year 5/semester 2/wrap302 - advanced programming 2/assignments/assignment1/task1_sos2/app/src/main/java/wrap302/nmu/task1_sos/mainactivity.java error:(85, 34) error: lambda expressions not supported in -source 1.7 (use -source 8 or higher enable lambda expressions) error:execution failed task ':app:compiledebugjavawithjavac'. > compilation failed; see compiler error output details. information:build failed information:total time: 1.054 secs information:3 errors information:0 warnings information:see complete output in console
any thoughts?
update
for suggesting may gradle issues:
project gradle build
<?xml version="1.0" encoding="utf-8"?> <module external.linked.project.id="task1_sos2" external.linked.project.path="$module_dir$" external.root.project.path="$module_dir$" external.system.id="gradle" type="java_module" version="4"> <component name="facetmanager"> <facet type="java-gradle" name="java-gradle"> <configuration> <option name="build_folder_path" value="$module_dir$/build" /> <option name="buildable" value="false" /> </configuration> </facet> </component> <component name="newmodulerootmanager" language_level="jdk_1_7" inherit-compiler-output="true"> <exclude-output /> <content url="file://$module_dir$"> <excludefolder url="file://$module_dir$/.gradle" /> </content> <orderentry type="inheritedjdk" /> <orderentry type="sourcefolder" fortests="false" /> </component> </module>
module gradle build
apply plugin: 'com.android.application' android { compilesdkversion 26 buildtoolsversion "26.0.1" defaultconfig { applicationid "wrap302.nmu.task1_sos" minsdkversion 15 targetsdkversion 26 versioncode 1 versionname "1.0" testinstrumentationrunner "android.support.test.runner.androidjunitrunner" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile filetree(include: ['*.jar'], dir: 'libs') androidtestcompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) compile 'com.android.support:appcompat-v7:26.0.0-alpha1' compile 'com.android.support.constraint:constraint-layout:1.0.2' testcompile 'junit:junit:4.12' compile 'com.android.support:gridlayout-v7:26.0.0-alpha1' }
to suggesting need change project language 8 (from 7), have done (reeason images proof), yet error persists, hence reason question unless missing in plain site.
side question: of concern, each time change language level 8, followed gradle change (i.e. added dependency, etc), language level defaults 7, normal?
check build.gradle files. might have settings override specified in ide. if case, either remove settings or modify them java 8 compatibility.
Comments
Post a Comment