-
Notifications
You must be signed in to change notification settings - Fork 24.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to fix the error "Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8." in React Native? #33416
Comments
As the message says, you need to run on Java 11. You're probably running on Java 1.8. The environment setup page on our website explains how to install Java 11: Closing here, but feel free to reopen if the issue is not solved. |
Thanks! It's resolved now and I faced another issue. |
Thanks @cortinico I updated jdk with flowing commands:
|
Only for linux users The first thing you have to do is install the JDK 11 package from oracle with the command sudo apt-get install openjdk-11-jdk Wait until the process is complete after that type command sudo apt-get update && sudo apt-get upgrade and it worked |
Thanks @mMarcos208 this command worked for me. |
in gradle.properties, org.gradle.java.home=C:/Program Files/Android/Android Studio/jre (refer to your path) |
Description
[admin@DF713 android % ./gradlew app:installDebug
FAILURE: Build failed with an exception.
Where:
Build file '/Users/admin/Downloads/ritehauler-user/android/app/build.gradle' line: 1
What went wrong:
A problem occurred evaluating project ':app'.
I am running the command from zsh terminal.
Thanks.
Version
0.67.2
Output of
npx react-native info
System:
OS: macOS 11.6
CPU: (4) x64 Intel(R) Core(TM) i7-8700B CPU @ 3.20GHz
Memory: 64.71 MB / 8.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.17.5 - ~/.nvm/versions/node/v14.17.5/bin/node
Yarn: 1.22.17 - ~/Downloads/ritehauler-user/node_modules/.bin/yarn
npm: 6.14.14 - ~/.nvm/versions/node/v14.17.5/bin/npm
Watchman: 2022.01.24.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.2 - /Users/admin/.gem/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
Android SDK:
API Levels: 28, 29, 32
Build Tools: 29.0.2, 32.1.0
System Images: android-29 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom, android-30 | Google Play Intel x86 Atom_64
Android NDK: Not Found
IDEs:
Android Studio: 2021.1 AI-211.7628.21.2111.8092744
Xcode: 12.5/12E262 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_292 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.67.2 => 0.67.2
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
Steps to reproduce
Run react-native run-android in project root directory.
Snack, code example, screenshot, or link to a repository
No response
The text was updated successfully, but these errors were encountered: