react-native: Plugin [id: 'org.jetbrains.kotlin.jvm', version: '1.7.22'] was not found in new CLI generated project

Description

I am getting the following output when building the out-of-the-box CLI project on Android.

Build file '.../AwesomeProject/node_modules/@react-native/gradle-plugin/build.gradle.kts' line: 13

Plugin [id: 'org.jetbrains.kotlin.jvm', version: '1.7.22'] was not found in any of the following sources:

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Exception is:
org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'org.jetbrains.kotlin.jvm', version: '1.7.22'] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.7.22')
  Searched in the following repositories:
    MavenRepo
    Google
    Gradle Central Plugin Repository
	at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.resolveToFoundResult(DefaultPluginRequestApplicator.java:237)

React Native Version

0.72.3

Output of npx react-native info

System:
  OS: macOS 13.4
  CPU: (12) arm64 Apple M2 Pro
  Memory: 95.66 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 16.20.1
    path: /opt/homebrew/bin/node
  Yarn:
    version: 1.22.19
    path: /opt/homebrew/bin/yarn
  npm:
    version: 8.19.4
    path: /opt/homebrew/bin/npm
  Watchman:
    version: 2023.07.10.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.12.1
    path: /Users/<redacted>/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 22.4
      - iOS 16.4
      - macOS 13.3
      - tvOS 16.4
      - watchOS 9.4
  Android SDK: Not Found
IDEs:
  Android Studio: 2022.3 AI-223.8836.35.2231.10406996
  Xcode:
    version: 14.3.1/14E300c
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 11.0.20
    path: /usr/bin/javac
  Ruby:
    version: 3.2.0
    path: /Users/<redacted>/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.3
    wanted: 0.72.3
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Steps to reproduce

npx react-native@latest init AwesomeProject yarn android

Snack, screenshot, or link to a repository

I’m not even getting the out-of-the-box CLI project to run on android so there isn’t a snack or screenshot that is relevant to the issue.

https://github.com/daileytj/reproducer-react-native

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 15 (1 by maintainers)

Most upvoted comments

hello, i have this issue, m1 pro, Ventura any fixes?

For anyone else having issues with this, after a couple of days of troubleshooting I just opened Android Studio and clicked on “Download Sources” and this finally seemed to download the JVM for me. Nothing else worked, neither yarn build or downloading any other version of JDK, or doing a gradle cleanup. Here’s the config that I’m on-

RN Version- 0.72 JDK- 11 (installed using homebrew via brew install openjdk@11)

Image

React Native says: If you already have a JDK on your system, we recommend JDK17. You may encounter problems using higher JDK versions.

If you’re using the latest version of Java Development Kit, you’ll need to change the Gradle version of your project so it can recognize the JDK. You can do that by going to{project root folder}\android\gradle\wrapper\gradle-wrapper.properties and changing the distributionUrl value to upgrade the Gradle version. You can check out here the latest releases of Gradle.

Things that worked for me was to run the following command : choco install -y microsoft-openjdk17 to install the correct version of JDK and install the required Android SDK’s and ensure that they are corrctly present in the environment Variables.

Copy and paste Get-ChildItem -Path Env:\ into powershell to verify that JAVA_HOME and ANDROID_HOME path is present in environment variables

Result should look like this: Screenshot 2024-03-19 174745

Hope it solves your Problem

Thanks, Keep Coding

work for me. i used java11

React Native says: If you already have a JDK on your system, we recommend JDK17. You may encounter problems using higher JDK versions.

If you’re using the latest version of Java Development Kit, you’ll need to change the Gradle version of your project so it can recognize the JDK. You can do that by going to{project root folder}\android\gradle\wrapper\gradle-wrapper.properties and changing the distributionUrl value to upgrade the Gradle version. You can check out here the latest releases of Gradle.

Things that worked for me was to run the following command : choco install -y microsoft-openjdk17 to install the correct version of JDK and install the required Android SDK’s and ensure that they are corrctly present in the environment Variables.

Copy and paste Get-ChildItem -Path Env:\ into powershell to verify that JAVA_HOME and ANDROID_HOME path is present in environment variables

Result should look like this: Screenshot 2024-03-19 174745

Hope it solves your Problem

Thanks, Keep Coding

If that helps someone: I was having the same issue and as funny as it sounds, the problem was my firewall.

The CI for the project you shared is green: https://github.com/daileytj/reproducer-react-native/actions/runs/5799873078/job/15720809672 Is this happening for any project you create?

Yes, turns out this was a proxy issue with android studio.

Hello. I’m facing the exact issue. How did you fix yours?

The CI for the project you shared is green: https://github.com/daileytj/reproducer-react-native/actions/runs/5799873078/job/15720809672

Is this happening for any project you create?

Yes, turns out this was a proxy issue with android studio.