question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to fix the error "Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8." in React Native?

See original GitHub issue

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’.

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.

  • Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

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® Core™ 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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

26reactions
mMarcos208commented, Apr 20, 2022

Thanks @cortinico

I updated jdk with flowing commands:

brew tap homebrew/cask-versions
brew install --cask zulu11
7reactions
iamabdulhaseebcommented, Apr 28, 2022

Thanks @mMarcos208 brew tap homebrew/cask-versions brew install --cask zulu11

this command worked for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android Gradle plugin requires Java 11 to ... - Stack Overflow
Locate the gradle.properties file in your project directory, create one if it's not present. Add the variable like this. org.gradle.java.home ...
Read more >
Android Gradle Plugin Requires Java 11 to Run - PSPDFKit
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8. You can try some of the following options: -...
Read more >
React Native Solve Android Gradle Plugin Requires Java 11 ...
11. Click on the OK button and Restart Your Computer to make it work. Now you're good to go. Your Android Gradle Plugin...
Read more >
[Solved] Android Gradle plugin requires Java 11 to run. You ...
when you are running app in android and getting this exceptionAndroid Gradle plugin requires Java 11 to run. You are currently using Java...
Read more >
Android Gradle plugin requires Java 11 to run. You ... - YouTube
... requires Java 11 to run. You are currently using Java 1.8.Article to Fix Error : https://www.codeprofessionally.com/how-to- fix - android -.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found