I'm trying to use java version 1.7 with android studio but unfortunately it is not working properly...
If set the version in File->Other settings -> Default project structure
to
Project SDK:
java version 1.7.0_06
Project language level:
7.0 Diamonds, ARM, multi-catch
But when I use a switch-statement with a string I get an error which should be possible in java 1.7, so do I need to set any other settings?
As per the docs, JDK 17 isn't supported yet in Android Studio. Actually, JDK 11 was supported starting from version 4.2 which was released in April 2021.
Set the JDK version Open your project in Android Studio and select File > Settings... > Build, Execution, Deployment > Build Tools > Gradle (Android Studio > Preferences... > Build, Execution, Deployment > Build Tools > Gradle on a Mac). Under Gradle JDK, choose the Embedded JDK option. Click OK.
Android Gradle plugin 3.0. 0 and later support all Java 7 language features and a subset of Java 8 language features that vary by platform version. When building your app using Android Gradle plugin 4.0. 0 and higher, you can use a number of Java 8 language APIs without requiring a minimum API level for your app.
Android SDK tools are not yet compatible with Java 11 and need Java 8 (1.8) to run correctly. The Bitrise stacks provide both Java 8 and Java 11, with Java 8 being active by default. If you need a Java 11 runtime for your project to compile, you can switch to Java 11 only before it's needed by the next Step.
No... there is no settings to change. Android SDK don't support full java 7 syntax, so you can't use it.
Note that java.nio.* (new in java 7 API) is supported by latest android version.
You can change it in new Android studio version(0.8.X)
FIle-> Other Settings -> Default Settings -> Compiler (Expand it by clicking left arrow) -> Java Compiler -> You can change the Project bytecode version here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With