I am running Android Studio 3.5 Beta 5. I have been following a rabbit hole starting with trying to run unit tests with Robolectric against Android SDK 29. I saw an error that required running with Java 9. When I went to install JDK 9, it directed me to 10, then 11, then 12!
I downloaded JDK 12 and now I would like to configure Android Studio's JDK location to be 12. However, when I attempt to do that, I get the following warning message: "Please choose a valid JDK 8 directory". See screenshots below.
Is there another setting I have to change to get this dialog to allow me to choose a JDK greater than 8? Or is it just not possible?
Set the JDK version A copy of the latest OpenJDK comes bundled with Android Studio 2.2 and higher, and this is the JDK version we recommend you use for your Android projects. To use the bundled JDK, do the following: Open your project in Android Studio and select File > Project Structure in the menu bar.
For the best development experience with the Android 12 SDK, use Android Studio Arctic Fox | 2020.3.1 or higher. Within Android Studio, you can install the Android 12 SDK as follows: Click Tools > SDK Manager. In the SDK Platforms tab, select Android 12. In the SDK Tools tab, select Android SDK Build-Tools 31. Click OK to install the SDK.
To use the bundled JDK, do the following: 1 Open your project in Android Studio and select File > Project Structure in the menu bar. 2 In the SDK Location page and under JDK location, check the Use embedded JDK checkbox. 3 Click OK.
3 you actually can compile Android apps using a higher JDK version while targeting Java 8 within your apps. it seems that this was supported in Android Studio versions before 3.5 beta 3, and according to the issue tracker, they plan on fixing this.
Oracle Java and Android Java aren't the same - they don't even use the same virtual machine.
So Sadly u can not use it now, until Android support it.
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