English 中文(简体)
React 原生错误: java. io. Un checkedIO 例外: 无法移动临时工作空间
原标题:React Native Error : java.io.UncheckedIOException: Could not move temporary workspace
What went wrong: java.io.UncheckedIOException: Could not move temporary workspace (C:UsersSreyaDesktopsreyalove-knotandroid.gradle8.6dependencies-accessors423f0288fa7dffe069445ffa4b72952b4629a15a-a4bfdb9a-3a8e-40d1-895b-328f0f4c6181) to immutable location (C:UsersSreyaDesktopsreyalove-knotandroid.gradle8.6dependencies-accessors423f0288fa7dffe069445ffa4b72952b4629a15a) I tried to clean Gradle with .gradlew clean and also upgraded my Gradle version, but that still didn t resolve the issue.
问题回答
I just got the same error and was able to solve it by changing just one character. you need to change the gradle version. your price is 8.6 or 8.7. Lower it to 8.5 change gradle wrapper properties : YourApp/android/gradle/wrapper/gradle-wrapper.properties : distributionUrl=https://services.gradle.org/distributions/gradle-8.5-all.zip
I encountered this issue when I upgraded to Gradle 8.6. I fixed it by Changing the from 8.6 to 8.5.
If you don t want to change the gradle version, you can try below steps : Inside your project directory run this command: npx react-native doctor if the output is this: type : npx react-native run-android then: npm start --reset-cache you might get this error: you can resolve this by adding port in composer.json file Now type: npm start --reset-cache hope this helps.
For new people to android, to archieve running the File ->New ->New project On: Android Studio Jellyfish 2023.3.1, April 12, 2024 built You will have to face: java.io.UncheckedIOException: Could not move temporary workspace (/my/folder/MyApplicationtestnew/.gradle/8.6/dependencies-accessors/4b...b9) to immutable location (/my/folder/MyApplicationtestnew/.gradle/8.6/dependencies-accessors/4b...fb) Could not move temporary workspace (/my/folder/MyApplicationtestnew/.gradle/8.6/dependencies-accessors/4b...b9) to immutable location (/my/folder/MyApplicationtestnew/.gradle/8.6/dependencies-accessors/4b...fb) I had to change from /my/folder/MyApplication/gradle/libs.versions.toml agp = "8.4.0" To-> agp = "8.3.0" And from /my/folder/MyApplication/gradle/wrapper/gradle-wrapper.properties distributionUrl=https://services.gradle.org/distributions/gradle-8.6-bin.zip To-> todistributionUrl=https://services.gradle.org/distributions/gradle-8.5-bin.zip
Easy Solution to Resolve React Native Error: java.io.UncheckedIOException - Could not move temporary workspace Locate the Gradle Wrapper Configuration File: Navigate to your React Native project directory and find the gradle-wrapper.properties file. It s typically located in the android/gradle/wrapper directory of your project. Open the gradle-wrapper.properties File: Use a text editor to open the gradle-wrapper.properties file. Find the distributionUrl Line: Look for a line in the file that starts with distributionUrl=. This line specifies the URL from which the Gradle distribution will be downloaded. Identify the Current Gradle Version: The distributionUrl contains the URL for the current version of Gradle. It might look something like this: distributionUrl=https://services.gradle.org/distributions/gradle-8.6-all.zip Downgrade Gradle Version: Change the version number in the URL to a previous version where the error didn t occur. For example: Previous version (e.g., Gradle 8.5): distributionUrl=https://services.gradle.org/distributions/gradle-8.5-all.zip Save the Changes: After modifying the distributionUrl, save the changes to the gradle-wrapper.properties file. Run Gradle Tasks: Run your Gradle tasks again. Gradle will now download and use the specified version (e.g., 8.5) instead of the problematic one. By following these steps, you can resolve the java.io.UncheckedIOException error related to the temporary workspace in your React Native project.
react-native: 0.74.3 run this command Inside your project directory. npm start --reset-cache then: npx react-native run-android
I had to install the latest version of Android Studio, switch gradle-wrapper.properties to 8.5 from 8.6, let Android Studio do gradle build (or whatever it does with gradle), then switch back to 8.6, start the emulator through Android Studio, and then it just worked. All these steps are definitely not required as I had encountered this issues a day or two ago and it fixed itself pretty quickly just by deleting the folder with the issue. It could definitely be an emulator issue as the emulator that was launched was completely clean.
I have just updated the gradle version to 8.3. like this, change gradle wrapper properties : YourApp/android/gradle/wrapper/gradle-wrapper.properties : distributionUrl=https://services.gradle.org/distributions/gradle-8.3-all.zip
I faced the same error! Solution: cd android > gradlew clean npx react-native run-android I didn t change the gradle version
just downgrade from 8.6 to 8.4 and then clean gradle it will work gradleanddistributionUrl=https://services.gradle.org/distributions/gradle-8.4-all.zip
try following steps: quit Android Studio; delete .gradle directory for the project; start gradle by ./gradew.bat --daemon in command line for the project; restart Android Studio.....
I install Jdk 17 I had the same error but after several hours I resolve it I change gradle version: change gradle wrapper properties : YourApp/android/gradle/wrapper/gradle-wrapper.properties : distributionUrl=https://services.gradle.org/distributions/gradle-8.3-all.zip I first changed to gradle-8.6-all.zip it does not work the gradle-8.3-all.zip work for me For more, you can check gradlew, gradlew.bat changes : https://react-native-community.github.io/upgrade-helper/?from=0.73.7&to=0.74.0




相关问题
Some error characters appear during the gradle javadoc task

Some error characters appear during the gradle javaDoc build Gradle version 7.1 and I am using windows I tried to change the project encoding to utf-8 and added the idea vm parameter -Dfile.encoding=...

What are real-world examples of Gradle s dependency graph?

As noted in the documentation, Gradle uses a directed acyclic graph (DAG) to build a dependency graph. From my understanding, having separate cycles for evaluation and execution is a major feature for ...

How can I import one Gradle script into another?

I have a complex Gradle script that wraps up a load of functionality around building and deploying a number of NetBeans projects to a number of environments. The script works very well, but in essence ...

热门标签