Skip to content Skip to sidebar Skip to footer

Try-with-resources Android Studio

I have a project that have a 'Project language level' = 6.0. I try to change this to 7.0 but this not changes, I believe that is because I selected the 'Minimum required SDK' as AP

Solution 1:

As you suspected, try-with-resources is only supported if your minSdkVersion is set to 19 or higher.

Support for Java 7 language features was added in March of 2014 (see here). However, try-with-resources requires updates to the runtime (and thus updates to the core Android OS), and those changes were not made until API 19 was released.

Post a Comment for "Try-with-resources Android Studio"