try-with-resources are not supported at this language level - Android -
try-with-resources are not supported at this language level - Android -
i have problem "try-with-resources not supported @ language level" in android in next posted code, tried set language 7 stills keeps giving me same illustration plus keeps giving me alternative alter language 7.
public string readfile(string filename) { seek (bufferedreader br = new bufferedreader(new filereader(filename+".txt"))) { stringbuilder sb = new stringbuilder(); string line = br.readline(); while (line != null) { sb.append(line); sb.append(system.lineseparator()); line = br.readline(); } string = sb.tostring(); homecoming everything; } grab (filenotfoundexception ex) { logger.getlogger(savenloadrank.class.getname()).log(level.severe, null, ex); } grab (ioexception ex) { logger.getlogger(savenloadrank.class.getname()).log(level.severe, null, ex); } homecoming "1"; }
try-with-resources supported if minsdkversion
set 19 or higher.
since uncertainty application targeting api version 19 or higher, problem.
support java 7 language features added in sdk tools revision 22.6 released in march of 2014 (see here). however, try-with-resources not feature possible introduce previous versions of android, applications using feature must run on 19+, minsdkversion
requirement.
android try-with-resources notsupportedexception
Comments
Post a Comment