问题描述
在 react-native 开发中,app 构建时会用到多个缓存:
In react-native development, there are multiple caches used when the app is built:
- React 原生打包缓存
- 模拟器缓存
- Java 端缓存 (.gradle) 文件夹(仅在 android 中)
- npm 缓存(如果相关?)
我是否也遗漏了什么?因为我正在尝试清除 react-native 中的缓存,以便能够重复仅在第一次使用时出现的错误.但是清除上面的那些缓存并没有帮助.这是在安卓上.在构建应用程序时,大多数行不会按预期显示 UP-TO-DATE,因为我清除了缓存.
Am I missing something also? Because I'm trying to clear cache in react-native, to be able to repeat a bug that only occurs on first usage. But clearing those caches above did not help. This is on android. When the app is building, most of the rows DO NOT say UP-TO-DATE, as expected, because I cleared the cache.
但是,仍然有很多行打印了此文本.喜欢:
But, there are still many rows where this text is printed. Like:
app:preBuild 最新版
app:preDebugBuild 最新版
app:preDebugBuild UP-TO-DATE
:app:preReleaseBuild 最新版
:app:preReleaseBuild UP-TO-DATE
问题是,如何清除与 react-native 开发相关的整个缓存?
The question is, how can I clear the whole cache related to react-native development?
推荐答案
对于 React Native Init 方法(没有 expo)使用:
For React Native Init approach (without expo) use:
npm start -- --reset-cache
这篇关于如何清除反应原生缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!