I got an error
"Android Gradle plugin requires Java 11 to run. You are currently using
Java 1.8"
I change it in IDE settings and JAVA_HOME environment variable. Errors in the terminal and build disappeared but emulator still doesn’t work.
My versions
Error in the emulator
The root cause of the problem
If anyone can, please help
4
Answers
The reason was obvious. I changed emulator, I don't understand why, but my ex emulator stopped working. I reinstall it many times (Nexus 5x), and changed api but it did not helped. Accidentally I installed Nexus 5 and all started work corectly.
Change your Gradle settings to this :
And keep the Gradle in App directory in v1.8 :
Regards this type of issue we can create a demo to check the configuration.
For an instance, I created a demo with
Empty Activity
and usingKotlin
.The configuration looks like this:
And we also need to check the configuration on the menu of
Project Structure
I always used theEmbedded JDK
which is in location ofAndroid Sutido
Of courseļ¼ you can specify other
JDK
you want to use.I faced this problem in react native
"react-native": "0.68.1"
in mac-m1& Java version is 1.8, instead of upgrading to java-11
i resolved error by running a diagnostic check using
npx @react-native-community/cli doctor
What is purpose of latest doctor command in React Native