How to solve "Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8"

How to solve "Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8"

I have recently encountered an issue when trying to create a local build on my Mac (M1), and since I couldn’t find a solution on Stack Overflow or other forums I have decided to post my own solution in case anybody needs it.

error terminal.png

To make it work, follow these 5 steps below:

  • Go to Oracle website, download and install the JAVA SE Development Kit. If you need step by step instruction, check oracle documentation.

oracle.png

  • Download and install the latest version of Android Studio:

android studio.png

  • After you have successfully installed Android Studio, open the application and select preferences. Check the image below. I have selected Appearance and Behavior => System Settings => Android SDK => SDK Tools.

android studio settings.png

  • From this section, install the packages below. Check Show package details to select specific version.

Screenshot 2022-10-26 at 15.15.29.png

Screenshot 2022-10-26 at 15.15.48.png

Screenshot 2022-10-26 at 15.16.10.png

  • Click on apply changes for those packages to install. When the installation is done, restart your IDE and try again.

Good luck! 🏆🚀 Let me know if you encountered any challenges.