Gradle v8.0 build fails react native v0.79.2
Description
Build failure with React Native v0.79.2 and Gradle v8.0.
** Note using Java 17
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH
Steps to reproduce
Build an android app with React Native v0.79.2 and Gradle v8.0 on linux.
Details:
------------------------------------------------------------
Gradle 8.0
------------------------------------------------------------
Build time: 2023-02-13 13:15:21 UTC
Revision: 62ab9b7c7f884426cf79fbedcf07658b2dbe9e97
Kotlin: 1.8.10
Groovy: 3.0.13
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 21.0.7 (Ubuntu 21.0.7+6-Ubuntu-0ubuntu124.04)
OS: Linux 6.8.0-58-generic amd64
React Native Version
0.79.2
Affected Platforms
Build - Linux
Output of npx @react-native-community/cli info
npx @react-native-community/cli info
info Fetching system and libraries information...
System:
OS: Linux 6.8 Ubuntu 24.04.2 LTS 24.04.2 LTS (Noble Numbat)
CPU: (16) x64 13th Gen Intel(R) Core(TM) i7-1360P
Memory: 9.37 GB / 31.01 GB
Shell:
version: 5.2.21
path: /bin/bash
Binaries:
Node:
version: 23.10.0
path: /usr/local/bin/node
Yarn: Not Found
npm:
version: 10.9.2
path: /usr/local/bin/npm
Watchman: Not Found
SDKs:
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Languages:
Java:
version: 17.0.15
path: /usr/bin/javac
Ruby: Not Found
npmPackages:
"@react-native-community/cli":
installed: 18.0.0
wanted: 18.0.0
react:
installed: 19.0.0
wanted: 19.0.0
react-native:
installed: 0.79.2
wanted: 0.79.2
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: Not found
newArchEnabled: false
Stacktrace or Logs
FAILURE: Build failed with an exception.
* Where:
Build file '/home/dev/app/node_modules/@react-native/gradle-plugin/shared-testutil/build.gradle.kts' line: 30
* What went wrong:
Script compilation errors:
* Line 30: allWarningsAsErrors =
^ Val cannot be reassigned
* Line 31: project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false
^ Type mismatch: inferred type is Boolean but Property<Boolean> was expected`
MANDATORY Reproducer
https://github.com/meghancampbel9/gradleIssue
Screenshots and Videos
No response
getting same issue
@Rahul0001k it was resolved in isse #51297. For a quick fix I recommend updating the gradle version in your project.
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
i upgrade my gradle version to 8.10.2-all.zip but still show
Could not resolve all artifacts for configuration ':classpath'. Could not find com.facebook.react:react-native-gradle-plugin:0.79.2.
I had the same issue with React Native 0.72.17, Gradle 8.0.1
I had the same issue with React Native 0.75.17, Gradle 8.0.1
My problem is because of yarn 4, I changed yarn version to 1 and it works, React Native 0.73+ seems to be yarn version 3