"ionic capacitor run android --livereload" fails because Android Gradle using Java 1.8

After getting my project to work with iOS I am really struggling to get the Android emulator to work.

The issue seems to be around an old version of Java (1.8) being used. I have tried various solutions including ensuring that the project is using Java 11 in Android Studio, but every time I try

ionic capacitor run android --livereload

I get the same build problems.

When checking the Gradle version with

./gradlew --version

I get:

Gradle 6.8

Build time: 2021-01-08 16:38:46 UTC
Revision: b7e82460c5373e194fb478a998c4fcfe7da53a7e

Kotlin: 1.4.20
Groovy: 2.5.12
Ant: Apache Ant™ version 1.10.9 compiled on September 27 2020
JVM: 1.8.0_301 (Oracle Corporation 25.301-b09)
OS: Mac OS X 10.16 x86_64

How do I get Gradle to use Java 11?

1 Like

Sorted it.

After looking for ways to set the Java version in the project I realised that the jdk set in Android Studio had not been downloaded and installed. Now getting correct version :slight_smile:

1 Like

Does this mean you installed java on your VSCode rather than Android Studio?