My current react-native version is "0.75.2" the minimum supported Gradle version is "8.7". But i get this error
FAILURE: Build failed with an exception.
- What went wrong:
java.io.UncheckedIOException: Could not move temporary workspace (C:UsersHermonProductAppandroid.gradle8.7dependencies-accessors569c8b261a8a714d7731d5f568e0e5c05babae10-47615e00-381c-4912-84ed-cab1f3c2e2df) to immutable location (C:UsersHermonProductAppandroid.gradle8.7dependencies-accessors569c8b261a8a714d7731d5f568e0e5c05babae10)
Could not move temporary workspace (C:UsersHermonProductAppandroid.gradle8.7dependencies-accessors569c8b261a8a714d7731d5f568e0e5c05babae10-47615e00-381c-4912-84ed-cab1f3c2e2df) to immutable location (C:UsersHermonProductAppandroid.gradle8.7dependencies-accessors569c8b261a8a714d7731d5f568e0e5c05babae10)
even if i change the Gradle version from 8.7 to 8.5, i get the error below
{FAILURE: Build failed with an exception.
-
Where:
Build file ‘C:UsersHermonProductAppandroidappbuild.gradle’ line: 1 -
What went wrong:
A problem occurred evaluating project ‘:app’.
Failed to apply plugin ‘com.android.internal.version-check’.
Minimum supported Gradle version is 8.7. Current version is 8.5. If using the gradle wrapper, try editing the distributionUrl in C:UsersHermonProductAppandroidgradlewrappergradle-wrapper.properties to gradle-8.7-all.zip}
what else should i do to get gradle 8.7 as the minimum supported gradle version is 8.7 for react-native "0.75.2"
2
Answers
Go to: android > build.gradle
Go to: android > settings.gradle
Add this following lines at top level
Go to: android > app > build.gradle
Add following line inside react body
and remove following line from bottom at app > build.gradle
Go to: gradle-wrapper.properties
Mac:
Windows:
After a week long hassle, I found the way to fix the issue.
First things first – No need to degrade Android Gradle Version or anything. So keep working with gradle version 8.7/8.8 which is mentioned in gradle_wrapper.properties file’s distributionURL.
Actual stuff starts here –
Step 1: Open cmd in root/android directory of your react native project and run gradlew.bat clean (it might be gradlew clean or .gradlew clean or .gradlew.bat depending on your operating system). .bat files are batch files for windows.
Optional: Resolve any path related or jdk version related issue if you encounter as you get it clearly in console.
Step 2: Run the command gradlew.bat –stop. It’ll stop the running daemon.
Step 3: Run the command gradlew.bat build and it’ll fix the issue but keep in mind that it’ll charge the significant data so be prepared.
Once the build is successful, you can run the command
npx react-native run android in your root directory and you’re all set.