Android Gradle plugin requires Java 11 to run

When using an outdated version of Android Studio, you may encounter the following error message:

Terminal window
> Failed to apply plugin 'com.android.internal.application'.
> Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing `org.gradle.java.home` in `gradle.properties`.

As a requirement to run, Nutrient React Native SDK needs the latest stable version of Android Studio(opens in a new tab). Starting with version 4.2, Android Studio is now bundled with JDK 11.

Once the installation has completed, enter the following in your terminal app:

Terminal window
java -version

Then, verify that the JDK version has been correctly updated to 11:

Terminal window
openjdk version "11.0.10" 2021-01-19
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.10+9)
Eclipse OpenJ9 VM AdoptOpenJDK (build openj9-0.24.0, JRE 11 Mac OS X amd64-64-Bit Compressed References 20210120_897 (JIT enabled, AOT enabled)
OpenJ9 - 345e1b09e
OMR - 741e94ea8
JCL - 0a86953833 based on jdk-11.0.10+9)