Closed HamoBoker closed 2 months ago
:warning: | Missing Reproducible Example |
---|---|
:information_source: | We could not detect a reproducible example in your issue report. Please provide either:
|
:warning: | Missing Reproducible Example |
---|---|
:information_source: | We could not detect a reproducible example in your issue report. Please provide either:
|
same issue
check your @react-native/gradle-plugin resolution in yarn.lock/package-lock.json; if you have any lingering other than 0.75.1 (eg i have 0.74.1 left in there) you have to remove node_modules and regenerate your lock file
@lovegaoshi is right. Can you confirm you have @react-native/gradle-plugin
version 0.75.1
installed?
@lovegaoshi is right. Can you confirm you have
@react-native/gradle-plugin
version0.75.1
installed?
I'll recheck and give you feedback
Thank you @lovegaoshi & @cortinico issue has been solved
@cortinico The problem occurred again after reinstalling node_modules.
I created a new project using npx @react-native-community/cli init
and faced the same issue. I tried removing ~/.gradle/caches and building again but that didn't solve the problem
Logs from the newly created app
~/Projects/SomeApp git:[main]
yarn android
info A dev server is already running for this project on port 8081.
info Installing the app...
info 💡 Tip: Make sure that you have set up your development environment correctly, by running npx react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor
FAILURE: Build failed with an exception.
* Where:
Settings file '/Users/hamoboker/Projects/SomeApp/android/settings.gradle' line: 2
* What went wrong:
Error resolving plugin [id: 'com.facebook.react.settings']
> Could not read workspace metadata from /Users/hamoboker/.gradle/caches/8.8/kotlin-dsl/accessors/b22002a57a45d84a557a6d199ea7ef01/metadata.bin
* 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 596ms
error Failed to install the app. Command failed with exit code 1: ./gradlew app:installDebug -PreactNativeDevServerPort=8081 FAILURE: Build failed with an exception. * Where:
Settings file '/Users/hamoboker/Projects/SomeApp/android/settings.gradle' line: 2 * What went wrong:
Error resolving plugin [id: 'com.facebook.react.settings']
> Could not read workspace metadata from /Users/hamoboker/.gradle/caches/8.8/kotlin-dsl/accessors/b22002a57a45d84a557a6d199ea7ef01/metadata.bin * 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 596ms.
info Run CLI with --verbose flag for more details.
Seems related to: https://github.com/gradle/gradle/issues/28974
I don't have a solution at the moment and I also cannot reproduce:
https://github.com/user-attachments/assets/62058329-2649-4e1a-9c6b-e109a4fd70f7
I would have suggested to attempt removing the .gralde/caches
folder which you already did.
I'd like to see if other users are also having this problem or not
/settings.gradle/ rootProject.name = 'your_project_name' 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')
/Android/app/build.gradle apply plugin: "com.android.application" apply plugin: "org.jetbrains.kotlin.android" apply plugin: "com.facebook.react"
/**
By default you don't need to apply any configuration, just uncomment the lines you need. / react { / Folders */ // The root of your project, i.e. where "package.json" lives. Default is '..' // root = file("../") // The folder where the react-native NPM package is. Default is ../node_modules/react-native // reactNativeDir = file("../node_modules/react-native") // The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen // codegenDir = file("../node_modules/@react-native/codegen") // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js // cliFile = file("../node_modules/react-native/cli.js")
/ Variants / // The list of variants to that are debuggable. For those we're going to // skip the bundling of the JS bundle and the assets. By default is just 'debug'. // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants. // debuggableVariants = ["liteDebug", "prodDebug"]
/ Bundling / // A list containing the node command and its flags. Default is just 'node'. // nodeExecutableAndArgs = ["node"] // // The command to run when bundling. By default is 'bundle' // bundleCommand = "ram-bundle" // // The path to the CLI configuration file. Default is empty. // bundleConfig = file(../rn-cli.config.js) // // The name of the generated asset file containing your JS bundle // bundleAssetName = "MyApplication.android.bundle" // // The entry file for bundle generation. Default is 'index.android.js' or 'index.js' // entryFile = file("../js/MyApplication.android.js") // // A list of extra flags to pass to the 'bundle' commands. // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle // extraPackagerArgs = []
/ Hermes Commands / // The hermes compiler command to run. By default it is 'hermesc' // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc" // // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map" // hermesFlags = ["-O", "-output-source-map"] }
/**
/**
def jscFlavor = 'org.webkit:android-jsc-intl:+'
Date.toLocaleString
and String.localeCompare
thatandroid { ndkVersion rootProject.ext.ndkVersion buildToolsVersion rootProject.ext.buildToolsVersion compileSdk rootProject.ext.compileSdkVersion
namespace "com.project2"
defaultConfig {
applicationId "com.project2"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
}
signingConfigs { release { storeFile file("your-release-key.keystore") storePassword "1111111" // Key store key enter keyAlias "your-key-alias" keyPassword "1111111" // Key store key enter } }
buildTypes { release { signingConfig signingConfigs.release minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" } }
}
dependencies { // The version of react-native is set by the React Native Gradle Plugin implementation("com.facebook.react:react-android")
if (hermesEnabled.toBoolean()) {
implementation("com.facebook.react:hermes-android")
} else {
implementation jscFlavor
}
}
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
I tried everything listed above but nothing is working.
@sarwanand24
I'm not sure if this will help, but you can also try this
pluginManagement { includeBuild(“../../../node_modules/@react-native/gradle-plugin”) }
plugins { id(“com.facebook.react.settings”) }
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
Change it like below
pluginManagement {
includeBuild(new File([“node”, “--print”, “require.resolve(‘@react-native/gradle-plugin/package.json’)”].execute(null, rootDir).text.trim()).getParentFile().toString())
}
plugins { id(“com.facebook.react.settings”) }
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
Test environment macos 14.4.1 (M1 Pro) Using pnpm workspace (monorepo) bare react-native 0.75.1 node 20.16.0
This got me past the above error, but I got an error on the expo-images side, so I downgraded to bare React Native temporarily. If you don't use the above packages, it should work :(
@jieey1140 I deleted the gradle many times and rebuild the project then it worked for me.
@lovegaoshi is right. Can you confirm you have
@react-native/gradle-plugin
version0.75.1
installed?
This worked for me too!
I have same issue, no metter what i do, i'm getting same error. Removed /node_modules, .gradle. Tried everything, but the error in Andorid remains.
did yall regenerate yarn.lock though
On Sun, Aug 18, 2024, 9:04 AM Djordje Devic @.***> wrote:
I have same issue, no metter what i do, i'm getting same error. Removed /node_modules, .gradle. Tried everything, but the error in Andorid remains.
— Reply to this email directly, view it on GitHub https://github.com/facebook/react-native/issues/46046#issuecomment-2295311265, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZMOVVUQ7SRSAXQQHAYPQBDZSDAXVAVCNFSM6AAAAABMSK64ACVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJVGMYTCMRWGU . You are receiving this because you were mentioned.Message ID: @.***>
Yes i did, everything from scratch installed with yarn
yarn add @react-native/gradle-plugin@0.75.1 --exact
Currently my issue is related to gradle cache
Could not read workspace metadata from /Users/hamoboker/.gradle/caches/[GRADLE_VERSION]
getting this error on GRADLE_VERSION = 8.8 and 8.6
[UPDATE]
@cortinico i solved my issue by removing rm -rf ~/.gradle/caches
and restarting the device
removing ~/.gradle/caches
without restarting didn't solve the problem.
@devic021 can you try this and share feedback ? if issue still occur make sure you have @react-native/gradle-plugin
installed
Projects tested on react-native@0.74.5 - gradle 8.6 react-native@0.75.1 - gradle 8.8
@HamoBoker thanks for the update, I'm closing then:
@cortinico i solved my issue by removing rm -rf ~/.gradle/caches and restarting the device removing ~/.gradle/caches without restarting didn't solve the problem so i guess restart is required after removing folder.
Generally doing:
cd android && ./gradlew --stop && rm -rf ~/.gradle/caches
should be sufficient rather than having to reboot.
Please open separate issues if you're having similar problmes.
Does anyone have this error ?
@HamoBoker thanks for the update, I'm closing then:
@cortinico i solved my issue by removing rm -rf ~/.gradle/caches and restarting the device removing ~/.gradle/caches without restarting didn't solve the problem so i guess restart is required after removing folder.
Generally doing:
cd android && ./gradlew --stop && rm -rf ~/.gradle/caches
should be sufficient rather than having to reboot.
@cortinico @HamoBoker Thanks, your solution works for me.
cd android && ./gradlew --stop && rm -rf ~/.gradle/caches
FAILURE: Build failed with an exception.
Where: Settings file 'D:\delet\reactnative\android\settings.gradle' line: 2
What went wrong: Error resolving plugin [id: 'com.facebook.react.settings']
still showing same error "node_modules/@react-native/gradle-plugin": { "version": "0.75.1", "resolved": "https://registry.npmjs.org/@react-native/gradle-plugin/-/gradle-plugin-0.75.1.tgz", "integrity": "sha512-a2gVjX3MB9TF9QZSKje79n1GDAnseTU94VIcFH/4DS3KjbK3yrNXsu1maxGZxDUAKmTUH7Rz4An/Rb5nkZG7dw==", "dev": true, "engines": { "node": ">=18" } },
FAILURE: Build failed with an exception.
Where: Settings file 'D:\delet\reactnative\android\settings.gradle' line: 2
What went wrong: Error resolving plugin [id: 'com.facebook.react.settings']
still showing same error "node_modules/@react-native/gradle-plugin": { "version": "0.75.1", "resolved": "https://registry.npmjs.org/@react-native/gradle-plugin/-/gradle-plugin-0.75.1.tgz", "integrity": "sha512-a2gVjX3MB9TF9QZSKje79n1GDAnseTU94VIcFH/4DS3KjbK3yrNXsu1maxGZxDUAKmTUH7Rz4An/Rb5nkZG7dw==", "dev": true, "engines": { "node": ">=18" } },
Hi @V-SATHISH2109, Last couple days ago, I was facing the same errors.
Below things work for me
JAVA -- version
cd android && ./gradlew --stop && rm -rf ~/.gradle/caches
I have one small doubt i want to use this command in project Android folders
On Sat, Aug 24, 2024, 9:37 AM Rahul Lodhi @.***> wrote:
FAILURE: Build failed with an exception.
-
Where: Settings file 'D:\delet\reactnative\android\settings.gradle' line: 2
What went wrong: Error resolving plugin [id: 'com.facebook.react.settings']
still showing same error @./gradle-plugin": { "version": "0.75.1", "resolved": " @./gradle-plugin/-/gradle-plugin-0.75.1.tgz ", "integrity": "sha512-a2gVjX3MB9TF9QZSKje79n1GDAnseTU94VIcFH/4DS3KjbK3yrNXsu1maxGZxDUAKmTUH7Rz4An/Rb5nkZG7dw==", "dev": true, "engines": { "node": ">=18" } },
Hi @V-SATHISH2109 https://github.com/V-SATHISH2109, Last couple days ago, I was facing the same errors.
Below things work for me
1.
Recheck the installed JAVA SDK version, react-native 0.75 requires a min JAVA sdk version 17. JAVA -- version 2.
Clean the gradle cache via below command inside the Android.
cd android && ./gradlew --stop && rm -rf ~/.gradle/caches
— Reply to this email directly, view it on GitHub https://github.com/facebook/react-native/issues/46046#issuecomment-2308043658, or unsubscribe https://github.com/notifications/unsubscribe-auth/A24F6GDP3CXDHAQKWOYNN73ZTABJ5AVCNFSM6AAAAABMSK64ACVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBYGA2DGNRVHA . You are receiving this because you were mentioned.Message ID: @.***>
I have one small doubt i want to use this command in project Android folders
On Sat, Aug 24, 2024, 9:37 AM Rahul Lodhi @.***> wrote:
FAILURE: Build failed with an exception.
-
Where: Settings file 'D:\delet\reactnative\android\settings.gradle' line: 2
What went wrong: Error resolving plugin [id: 'com.facebook.react.settings']
still showing same error @./gradle-plugin": { "version": "0.75.1", "resolved": " @./gradle-plugin/-/gradle-plugin-0.75.1.tgz ", "integrity": "sha512-a2gVjX3MB9TF9QZSKje79n1GDAnseTU94VIcFH/4DS3KjbK3yrNXsu1maxGZxDUAKmTUH7Rz4An/Rb5nkZG7dw==", "dev": true, "engines": { "node": ">=18" } },
Hi @V-SATHISH2109 https://github.com/V-SATHISH2109, Last couple days ago, I was facing the same errors.
Below things work for me
1.
Recheck the installed JAVA SDK version, react-native 0.75 requires a min JAVA sdk version 17. JAVA -- version 2.
Clean the gradle cache via below command inside the Android.
cd android && ./gradlew --stop && rm -rf ~/.gradle/caches
— Reply to this email directly, view it on GitHub https://github.com/facebook/react-native/issues/46046#issuecomment-2308043658, or unsubscribe https://github.com/notifications/unsubscribe-auth/A24F6GDP3CXDHAQKWOYNN73ZTABJ5AVCNFSM6AAAAABMSK64ACVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBYGA2DGNRVHA . You are receiving this because you were mentioned.Message ID: @.***>
No, you can run from projects's root folder, because this command already includes the change directory command for changing the folder.
@react-native/gradle-plugin
Adding it as a devDependency solved it for me
yarn add @react-native/gradle-plugin@0.75.1 --exact
This gives the following error
I was facing this problem when i upgraded an old project to the latest RN version 0.75.2
and i managed to solve it in android studio, open file > Project Structure > Project and i have set gradle version to 8.2.0
Just started the project with the latest version of React Native at first build only got this error
java.io.UncheckedIOException: Could not move temporary workspace
i tried removing gradle caches etc Nope!
same issue
Claro! Aqui está a tradução do seu passo a passo:
Simple solution:
.gradle
foldercd android
gradlew clean
yarn android
Thank me later!!
After deeply investigated this issue, this is my verdict to fix the issue for React Native version 0.74.5
.
yarn react-native-clean-project
.cd android && ./gradlew --stop && rm -rf ~/.gradle/caches && cd ..
yarn add @react-native/gradle-plugin@0.75.1 --exact
. You don't need it.Is has everything to do with a dangling react-native/gradle-plugin in the yarn.lock
file.
If you have the react-native-windows
dependency in your package.json
ensure it has the same version as the react-native
dependency. Fix this first before performing the next steps. If this does not fix it after performing the steps below, it has something to do with another outdated dependency in the packages.json
Perform the next steps from the root of your project.
yarn.lock
file. (Deleting the file will make yarn
unhappy)node_modules
yarn install
cd android
gradlew clean
yarn android
This will fix it. Happy coding! 😄
Does anyone know what's going on here have any idea what to do about it? react-native 0.71.3 Sync Project with Gradle Files Resulting error
Claro! Aqui está a tradução do seu passo a passo:
Simple solution:
- Restart your PC
- Navigate to your project
- Delete the
.gradle
folder- Run
cd android
- Run
gradlew clean
- Run
yarn android
Thank me later!!
I had the same issue unitl I followed these step. Thank you so much issue resolved.
If you are using windows, it has a limit on file path length, which may cause issues.
You can enable long path support: Press Win + R, type gpedit.msc and OK
Now: Computer Configuration > Administrative Templates > System > Filesystem > Enable Win32 long paths
Last: Double-click Enable Win32 long paths and set it to Enabled.
(P.S. for me problem was that gradle cached some files in super long folder name on windows)
for \android\settings.gradle' line: 2 * What went wrong: Error resolving plugin [id: 'com.facebook.react.settings']
error
just run npm install @react-native/gradle-plugin@0.75.1 --exact or if yarn yarn add @react-native/gradle-plugin@0.75.1 --exact
I just ran into this issue when using expo@next and upgrading to new arch then downgrading.
My solution was was ./gradlew --stop && rm -rf ./gradle/caches && ./gradlew clean
Worth noting I also cleared node_module and deleted and prebuilt the android project to no prevail.
Getting same error
FAILURE: Build failed with an exception.
Where: Settings file 'C:\Users\hp\Desktop\react-native-world\01\AwesomeProject\android\settings.gradle' line: 2
What went wrong: Error resolving plugin [id: 'com.facebook.react.settings']
java.io.UncheckedIOException: Could not move temporary workspace (C:\Users\hp\Desktop\react-native-world\01\AwesomeProject\android.gradle\8.10.2\dependencies-accessors\569c8b261a8a714d7731d5f568e0e5c05babae10-2a394f4b-039c-4c6d-9410-de2b202a8c22) to immutable location (C:\Users\hp\Desktop\react-native-world\01\AwesomeProject\android.gradle\8.10.2\dependencies-accessors\569c8b261a8a714d7731d5f568e0e5c05babae10)
"dependencies": { "@react-native/gradle-plugin": "^0.75.1", "react": "18.3.1", "react-native": "0.76.1" },
Description
build fail on android after upgrading from 0.74.5 to 0.75.1 caused by "/android/settings.gradle' line: 2"
i'm using monorepo, i rechecked node_modules path and it is correct
Steps to reproduce
React Native Version
0.75.1
Affected Platforms
Runtime - Android
Output of
npx react-native info
Stacktrace or Logs
Reproducer
...
Screenshots and Videos
No response