由于Gradle Cache中缺少文件,反应新的Android构建失败了吗?
我目前正在为iOS和Android做出反应。我想添加4个新软件包(react-native-endative-ender handler
,react-nimative-reative-reanimated
,react-native-native-native-native-safe-area-context
代码>和@gorhom/bottom-sheet
),然后在安装时给我一些麻烦,因此我切换到另一个软件包,该软件包会替换这4个没有任何麻烦。
现在的问题是,即使将项目滚动到了以前的状态之后,运行npm Run-android
时仍在崩溃,并带有错误:
> [email protected] android
> react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1001 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Launching emulator...
info Successfully launched emulator.
info Installing the app...
> Task :app:checkDebugAarMetadata FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
12 actionable tasks: 2 executed, 10 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Multiple build operations failed.
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/acdba564cab10d0f31716104c08ecbee/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/0051ba15206e71d5f2b7a6f0ed776860/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/4e2e869708901347ef158aa1a9aed1f4/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/f684783603be85eb4c827960e04e8a60/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/e027a88f08932b9116d6e1bd45f24a79/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/c08ba6ec0daadcde11699fa34d40b295/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/c0b89d21d6409c50b59e277bb5915751/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/f38a0e4adb2cb6c27096544b7d9f257a/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/49b1d43dd024794a47163e54aa8a0a89/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/52f1cba1c3b05bb59b006a525e2f4d4d/results.bin
...and 87 more failures.
> java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/acdba564cab10d0f31716104c08ecbee/results.bin
> java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/0051ba15206e71d5f2b7a6f0ed776860/results.bin
> java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/22f4e52b551ac1cfb5cd025e9c5de9c1/results.bin
> java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/d4405dbab538bff995a2a0c862019c94/results.bin
[... and so on for about ~50 more files]
* 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 4s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Multiple build operations failed.
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/acdba564cab10d0f31716104c08ecbee/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/0051ba15206e71d5f2b7a6f0ed776860/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/4e2e869708901347ef158aa1a9aed1f4/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/f684783603be85eb4c827960e04e8a60/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/e027a88f08932b9116d6e1bd45f24a79/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/c08ba6ec0daadcde11699fa34d40b295/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/c0b89d21d6409c50b59e277bb5915751/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/f38a0e4adb2cb6c27096544b7d9f257a/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/49b1d43dd024794a47163e54aa8a0a89/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/52f1cba1c3b05bb59b006a525e2f4d4d/results.bin
...and 87 more failures.
> java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/acdba564cab10d0f31716104c08ecbee/results.bin
> java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/0051ba15206e71d5f2b7a6f0ed776860/results.bin
> java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/22f4e52b551ac1cfb5cd025e9c5de9c1/results.bin
> java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/d4405dbab538bff995a2a0c862019c94/results.bin
[... and so on for about ~50 more files]
* 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 4s
at makeError (/Volumes/privateWorkspace/hbmggmbh/LF2Frontend/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:174:9)
at /Volumes/privateWorkspace/hbmggmbh/LF2Frontend/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (/Volumes/privateWorkspace/hbmggmbh/LF2Frontend/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
at async Command.handleAction (/Volumes/privateWorkspace/hbmggmbh/LF2Frontend/node_modules/@react-native-community/cli/build/index.js:192:9)
info Run CLI with --verbose flag for more details.
在我解决其他错误时,我得到了在尝试实现4个软件包时,我正在谈论我ran rm -r $ home/.gradle/.gradle/caches/
,这是我找到的解决方案在stackoverflow上当时工作。由于它只是删除了缓存,所以我没有考虑太多。
该项目现在“运行” on:
"dependencies": {
"prop-type": "^0.0.1",
"react": "18.0.0",
"react-native": "0.69.0",
"react-native-geolocation-service": "^5.3.0",
"react-native-maps": "^0.31.1"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@babel/runtime": "^7.12.5",
"@react-native-community/eslint-config": "^2.0.0",
"babel-jest": "^26.6.3",
"eslint": "^7.32.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.70.3",
"react-native-sass-transformer": "^2.0.0",
"react-test-renderer": "18.0.0"
}
我使用的版本:
------------------------------------------------------------
Gradle 7.4.2
------------------------------------------------------------
Build time: 2022-03-31 15:25:29 UTC
Revision: 540473b8118064efcc264694cbcaa4b677f61041
Kotlin: 1.5.31
Groovy: 3.0.9
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 18.0.1.1 (Homebrew 18.0.1.1+0)
OS: Mac OS X 12.1 x86_64
我尝试修复此操作的内容列表:
- 重新安装Gradle
- 重新安装Android Studio以及我运行的所有模拟器
gradle-建造-cache
- 运行<代码> gradle cleanbuildcache
- 这导致了
任务'cleanbuildCache'在root Project'lf2frontend'中找不到。
错误
- 这导致了
- 删除
node_modules/
和package> package> package-lock.json
,然后运行npm i
再次 - 清除反应新的缓存
- 清除NPM缓存
- ,最拼命地:我尝试复制Gradle Cache
.gradle/caches/transforms-3/
从我的一个队友进入我的高速缓存文件夹,希望这可以做点什么。
在这一点上,我完全迷失了,也很困惑这样的事情甚至会发生。
有人知道如何帮助这一点吗?提前致谢
I am currently working on a react-native for ios and android. I wanted to add 4 new packages (react-native-gesture-handler
, react-native-reanimated
, react-native-safe-area-context
and @gorhom/bottom-sheet
) which then caused me some trouble when installing so I switched to another package which would replace these 4 without any trouble.
The problem now is that even after rolling back the project to exactly how it was before, it's still crashing when running npm run-android
with the error:
> [email protected] android
> react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1001 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Launching emulator...
info Successfully launched emulator.
info Installing the app...
> Task :app:checkDebugAarMetadata FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
12 actionable tasks: 2 executed, 10 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Multiple build operations failed.
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/acdba564cab10d0f31716104c08ecbee/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/0051ba15206e71d5f2b7a6f0ed776860/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/4e2e869708901347ef158aa1a9aed1f4/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/f684783603be85eb4c827960e04e8a60/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/e027a88f08932b9116d6e1bd45f24a79/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/c08ba6ec0daadcde11699fa34d40b295/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/c0b89d21d6409c50b59e277bb5915751/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/f38a0e4adb2cb6c27096544b7d9f257a/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/49b1d43dd024794a47163e54aa8a0a89/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/52f1cba1c3b05bb59b006a525e2f4d4d/results.bin
...and 87 more failures.
> java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/acdba564cab10d0f31716104c08ecbee/results.bin
> java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/0051ba15206e71d5f2b7a6f0ed776860/results.bin
> java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/22f4e52b551ac1cfb5cd025e9c5de9c1/results.bin
> java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/d4405dbab538bff995a2a0c862019c94/results.bin
[... and so on for about ~50 more files]
* 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 4s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Multiple build operations failed.
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/acdba564cab10d0f31716104c08ecbee/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/0051ba15206e71d5f2b7a6f0ed776860/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/4e2e869708901347ef158aa1a9aed1f4/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/f684783603be85eb4c827960e04e8a60/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/e027a88f08932b9116d6e1bd45f24a79/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/c08ba6ec0daadcde11699fa34d40b295/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/c0b89d21d6409c50b59e277bb5915751/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/f38a0e4adb2cb6c27096544b7d9f257a/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/49b1d43dd024794a47163e54aa8a0a89/results.bin
java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/52f1cba1c3b05bb59b006a525e2f4d4d/results.bin
...and 87 more failures.
> java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/acdba564cab10d0f31716104c08ecbee/results.bin
> java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/0051ba15206e71d5f2b7a6f0ed776860/results.bin
> java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/22f4e52b551ac1cfb5cd025e9c5de9c1/results.bin
> java.nio.file.NoSuchFileException: /Users/private/.gradle/caches/transforms-3/d4405dbab538bff995a2a0c862019c94/results.bin
[... and so on for about ~50 more files]
* 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 4s
at makeError (/Volumes/privateWorkspace/hbmggmbh/LF2Frontend/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:174:9)
at /Volumes/privateWorkspace/hbmggmbh/LF2Frontend/node_modules/@react-native-community/cli-platform-android/node_modules/execa/index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (/Volumes/privateWorkspace/hbmggmbh/LF2Frontend/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
at async Command.handleAction (/Volumes/privateWorkspace/hbmggmbh/LF2Frontend/node_modules/@react-native-community/cli/build/index.js:192:9)
info Run CLI with --verbose flag for more details.
During the time as I was fixing the other errors I got when trying to implement the 4 packages I was talking about I ran rm -r $HOME/.gradle/caches/
which was a solution I found here on stackoverflow and worked at the time. Since it's just deleting the cache I didnt think much of it.
The project now "runs" on:
"dependencies": {
"prop-type": "^0.0.1",
"react": "18.0.0",
"react-native": "0.69.0",
"react-native-geolocation-service": "^5.3.0",
"react-native-maps": "^0.31.1"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@babel/runtime": "^7.12.5",
"@react-native-community/eslint-config": "^2.0.0",
"babel-jest": "^26.6.3",
"eslint": "^7.32.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.70.3",
"react-native-sass-transformer": "^2.0.0",
"react-test-renderer": "18.0.0"
}
Versions used by me:
------------------------------------------------------------
Gradle 7.4.2
------------------------------------------------------------
Build time: 2022-03-31 15:25:29 UTC
Revision: 540473b8118064efcc264694cbcaa4b677f61041
Kotlin: 1.5.31
Groovy: 3.0.9
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 18.0.1.1 (Homebrew 18.0.1.1+0)
OS: Mac OS X 12.1 x86_64
List of things I tried to fix this:
- Reinstall gradle
- Reinstall android studio and all of my emulators
- Running
gradle --build-cache
- Running
gradle cleanBuildCache
- This resulted in a
Task 'cleanBuildCache' not found in root project 'LF2Frontend'.
error
- This resulted in a
- Removing
node_modules/
andpackage-lock.json
and then runningnpm i
again - Clearing react-native cache
- Clearing npm cache
- And most desperately: I tried copying the gradle cache
.gradle/caches/transforms-3/
from one of my teammates into my cache folder, hoping this might do something.
At this point I am completely lost and also very confused how something like this could even happen.
Does anyone know how to help with this? Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在执行
rm -rf〜/.gradle/caches/
之后,我处于完全相同的情况。最终通过删除整个
〜/.gradle
文件夹来解决它,而不仅仅是caches
subdirectory。然后,在运行
反应式运行android
之后,React Native从自动重建Gradle伪像。然后我的RN Android构建再次成功。希望这有帮助!
I was in exact same situation after performing
rm -rf ~/.gradle/caches/
.Eventually solved it by removing the entire
~/.gradle
folder, not justcaches
subdirectory.Then, after running
react-native run-android
again, React Native started with rebuilding Gradle artifacts automatically. Then my RN Android builds were successful again.Hope this helps!