Closed nikit-psl closed 1 year ago
Have you yarn install
afterwards?
Can you run ls -la node_modules/react-native-gradle-plugin
and return the output?
Yes, I deleted node_modules
folder and ran yarn install
command after upgrading everything else.
Output of ls -la node_modules/react-native-gradle-plugin
-
total 56
drwxr-xr-x 12 admin staff 384 Jun 19 12:11 .
drwxr-xr-x 803 admin staff 25696 Jun 19 12:10 ..
drwxr-xr-x 3 admin staff 96 Jun 19 12:11 .gradle
-rw-r--r-- 1 admin staff 488 Aug 3 2022 README.md
-rw-r--r-- 1 admin staff 868 Aug 3 2022 build.gradle.kts
drwxr-xr-x 3 admin staff 96 Jun 19 12:09 gradle
-rwxr-xr-x 1 admin staff 5774 Aug 3 2022 gradlew
-rw-r--r-- 1 admin staff 2763 Aug 3 2022 gradlew.bat
drwxr-xr-x 4 admin staff 128 Jun 19 12:09 node_modules
-rw-r--r-- 1 admin staff 744 Aug 3 2022 package.json
-rw-r--r-- 1 admin staff 281 Aug 3 2022 settings.gradle.kts
drwxr-xr-x 3 admin staff 96 Jun 19 12:09 src
can you share the output of your android/gradle/wrapper/gradle-wrapper.properties
file?
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
:warning: | Missing Reproducible Example |
---|---|
:information_source: | It looks like your issue is missing a reproducible example. Please provide either:
|
Thanks for sharing. Unfortunately I can't help you further without a reproducer.
@cortinico not sure why this worked, but when I manually installed react-native-gradle-plugin
, the issue got fixed. I know that it's not recommended as mentioned here, but this is the only thing that worked for me as of now. Any ideas what might be happening?
Any ideas what might be happening?
Sadly not. Can you try to remove the manual installation of react-native-gradle-plugin
and then try to yarn why react-native-gradle-plugin
and share the output? I'm wondering if there is something goign on with package dependencies.
I'm also experiencing this exact issue. What I simple did was to comment out. I also discovered that this might be happening to those of us who aren't using fresh installation.
The react native upgrade helper shows that we need to reference react-native-gradle-plugin at some point. https://react-native-community.github.io/upgrade-helper/?from=0.66.5&to=0.68.0#RnDiffApp-android-settings.gradle
I'm having the same problem with RN 0.71.10
What I simple did was to comment out.
Comment out what @Devmaleeq ?
I had this same issue which I'm pretty sure was due to incorrect java version (8). It resolved after switching java version to 11. https://reactnative.dev/docs/next/environment-setup?platform=android#jdk
Make sure you you follow the upgrade steps in your android/build.gradle
I'm facing the same issue, no news? =( this is really sad
Closing as @nikit-psl is unresponsive.
This issue is most likely caused from a wrong settings.gradle
file in your project.
Specifically, if you're on React Native 0.72+, that file should look as follows: https://github.com/facebook/react-native/blob/79c4ec1a9a27dc0fd76c1a65ebcb77257d3d4095/packages/react-native/template/android/settings.gradle#L2-L4
If you're on React Native <= 0.71, it should look as follows: https://github.com/facebook/react-native/blob/7636e4c10209ab26b0d9f79ca34d08e874635dd1/template/android/settings.gradle#L2-L4
this error may be caused by incorrect jdk version in android studio
i had to reinstall react-native-gradle-plugin
Closing as @nikit-psl is unresponsive.
This issue is most likely caused from a wrong
settings.gradle
file in your project.Specifically, if you're on React Native 0.72+, that file should look as follows:
If you're on React Native <= 0.71, it should look as follows:
this worked for me.
@cortinico Thankyou
Closing as @nikit-psl is unresponsive.
This issue is most likely caused from a wrong
settings.gradle
file in your project.Specifically, if you're on React Native 0.72+, that file should look as follows:
If you're on React Native <= 0.71, it should look as follows:
This does NOT work when you have set the combination:
settings.gradle:
includeBuild('../node_modules/@react-native/gradle-plugin')
build.gradle:
classpath("com.facebook.react:react-native-gradle-plugin")
app/build.gradle:
apply plugin: "com.facebook.react"
I had same configuration as @dimisus above and got it resolved by doing npm i react-native-gradle-plugin
- which installed "react-native-gradle-plugin": "^0.71.19" .
The plugin is already configured for new projects created using npx react-native init. You don't need to do any extra steps to install it if you created your app with this command. https://reactnative.dev/docs/react-native-gradle-plugin
My guess is when you run the build somewhere other than where you did react-native init ; like on git CI VM ; the package doesnt exist anywhere.
error before doing npm i react-native-gradle-plugin in the project.
Run cd android && ./gradlew assembleDebug --no-daemon
Downloading https://services.gradle.org/distributions/gradle-[8](https://github.com/daskabe/abc-reactNative-typescript-mobile/actions/runs/7110134331/job/19356153804#step:11:9).0.1-all.zip
...............10%................20%................30%................40%................50%................60%................70%................80%................[9](https://github.com/daskabe/abc-reactNative-typescript-mobile/actions/runs/7110134331/job/19356153804#step:11:10)0%................[10](https://github.com/daskabe/abc-reactNative-typescript-mobile/actions/runs/7110134331/job/19356153804#step:11:11)0%
Welcome to Gradle 8.0.1!
Here are the highlights of this release:
- Improvements to the Kotlin DSL
- Fine-grained parallelism from the first build with configuration cache
- Configurable Gradle user home cache cleanup
For more details see https://docs.gradle.org/8.0.1/release-notes.html
To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/8.0.1/userguide/gradle_daemon.html#sec:disabling_the_daemon.
Daemon will be stopped at the end of the build
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'abc_rn_ts_mobile'.
> Could not determine the dependencies of null.
> Could not resolve all task dependencies for configuration ':classpath'.
> Could not resolve com.facebook.react:react-native-gradle-plugin.
Required by:
project :
> Module version 'com.facebook.react:react-native-gradle-plugin' is not unique in composite: can be provided by [project :gradle-plugin, project :react-native-gradle-plugin].
* 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.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m [25](https://github.com/daskabe/abc-reactNative-typescript-mobile/actions/runs/7110134331/job/19356153804#step:11:26)s
settings.gradle
rootProject.name = 'abc_rn_ts_mobile'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
includeBuild('../node_modules/@react-native/gradle-plugin')
build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "33.0.0"
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 33
// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
ndkVersion = "23.1.7779620"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.3.1")
classpath("com.facebook.react:react-native-gradle-plugin")
}
}
allprojects {
repositories {
google()
jcenter()
}
}
In my settings.gradle, I had to change
includeBuild('../node_modules/@react-native/gradle-plugin')
to
includeBuild('../node_modules/react-native-gradle-plugin')
in order match the classpath
in the build.gradle of
classpath("com.facebook.react:react-native-gradle-plugin")
However, I noticed that the @react-native/gradle-plugin
package has the latest updates on NPM and that react-native-gradle-plugin
is likely deprecated or will be soon. The only issue with using the @react-native/gradle-plugin
version is that I don't know how to add the correct syntax in the classpath
.
I tried this, for example, which doesn't work:
classpath("com.facebook.react:@react-native/gradle-plugin")
Does anybody know how to write that syntax correctly so it lines up with the new package name?
This works for me. Thx all!
android/build.gradle buildscript { ext { kotlin_version = '1.9.22' buildToolsVersion = "34.0.0" minSdkVersion = 30 compileSdkVersion = 34 targetSdkVersion = 34
}
dependencies {
classpath("com.android.tools.build:gradle:8.3.0")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath "de.undercouch:gradle-download-task:5.4.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
settings.gradle apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) include ':app' includeBuild('../node_modules/@react-native/gradle-plugin')
Have you
yarn install
afterwards? Can you runls -la node_modules/react-native-gradle-plugin
and return the output?
I ran across this same issue/error today and I found this github issue from google... I followed @cortinico suggestion to output the react-native-gradle-plugin
folder and this is what I saw:
total 8
drwxr-xr-x 4 davidpaul staff 128 Mar 9 09:19 .
drwxr-xr-x@ 675 davidpaul staff 21600 Mar 9 09:19 ..
-rw-r--r-- 1 davidpaul staff 933 Mar 9 09:19 .project
drwxr-xr-x 3 davidpaul staff 96 Mar 9 09:19 bin
This was after multiple rm -rf node_modules && npm i
... For some reason that package wasn't fully downloading, so I manually added it via npm i react-native-gradle-plugin
, et voila!
total 56
drwxr-xr-x@ 11 davidpaul staff 352 Mar 9 09:28 .
drwxr-xr-x@ 675 davidpaul staff 21600 Mar 9 09:28 ..
-rw-r--r--@ 1 davidpaul staff 488 Mar 9 09:28 README.md
drwxr-xr-x 10 davidpaul staff 320 Mar 9 09:28 bin
-rw-r--r--@ 1 davidpaul staff 1657 Mar 9 09:28 build.gradle.kts
drwxr-xr-x@ 3 davidpaul staff 96 Mar 9 09:28 gradle
-rwxr-xr-x@ 1 davidpaul staff 8070 Mar 9 09:28 gradlew
-rw-r--r--@ 1 davidpaul staff 2763 Mar 9 09:28 gradlew.bat
-rw-r--r--@ 1 davidpaul staff 711 Mar 9 09:28 package.json
-rw-r--r--@ 1 davidpaul staff 339 Mar 9 09:28 settings.gradle.kts
drwxr-xr-x@ 3 davidpaul staff 96 Mar 9 09:28 src
For some reason the entire package was not being pulled from NPM, so I had to manually do it. Everything works now.
RN 0.70.6
so I manually added it via
npm i react-native-gradle-plugin
, et voila!
Doing npm i react-native-gradle-plugin
is not correct and will break your project the next time you update react native
running npm i -g
fixes it
IN MY CASE I RESTARTED WATCHMAN
In my case the issue was because of react-native-screens. Result of yarn why react-native-gradle-plugin
=> Found "react-native-gradle-plugin@0.0.3"
info Reasons this module exists
- "react-native-screens" depends on it
- Hoisted from "react-native-screens#react-native-gradle-plugin"
info Disk size without dependencies: "472KB"
info Disk size with unique dependencies: "2.18MB"
info Disk size with transitive dependencies: "27.36MB"
info Number of shared dependencies: 85
=> Found "react-native#react-native-gradle-plugin@0.70.3"
info This module exists because "react-native" depends on it.
info Disk size without dependencies: "260KB"
info Disk size with unique dependencies: "260KB"
info Disk size with transitive dependencies: "260KB"
info Number of shared dependencies: 0
i wasn't using it so simply uninstall the library fixed the problem for me
make sure node_modules/@react-native/gradle-plugin is exist, in my case this file is not exist and re install package use npm install
New Version
0.71.11
Old Version
0.67.5
Build Target(s)
While building for Android
Output of
react-native info
Issue and Reproduction Steps
While building the app for Android after upgrading React Native I'm getting this error
Thing's I've tried
Files -
package.json
android/build.gradle
android/app/build.gradle
settings.gradle
Screenshot