Currently it seems there's an attempt to restrict the code to be compatible with Java 6, for example using explicit types in generic creation (e.g: ArrayList<String> strings = new ArrayList<String>();).
There's really no need to do so, as upgrading the Java version will not break it on old devices. Currently the target version isn't explicitly defined in the build.gradle anyway, and if it is set to Java 6 (1.6), there are errors such as strings in switch are not supported in 1.6.
For this reason I'd recommend explicitly setting the target/source version to Java 8 (1.8), allowing for more language features such as generic type defs (ArrayList<>()), lambdas, and more.
Note that the IDE will still be smart enough to not allow Java 8 features that aren't supported on the minSdkVersion, such as streams. Although these are added in Java 8, they're not supported on Icecream Sandwich, so it will throw an error. This allows the best of both worlds.
Currently it seems there's an attempt to restrict the code to be compatible with Java 6, for example using explicit types in generic creation (e.g:
ArrayList<String> strings = new ArrayList<String>();
).There's really no need to do so, as upgrading the Java version will not break it on old devices. Currently the target version isn't explicitly defined in the
build.gradle
anyway, and if it is set to Java 6 (1.6), there are errors such asstrings in switch are not supported in 1.6
.For this reason I'd recommend explicitly setting the target/source version to Java 8 (1.8), allowing for more language features such as generic type defs (
ArrayList<>()
), lambdas, and more.Note that the IDE will still be smart enough to not allow Java 8 features that aren't supported on the minSdkVersion, such as streams. Although these are added in Java 8, they're not supported on Icecream Sandwich, so it will throw an error. This allows the best of both worlds.