我正在开发 React Native 应用程序 (v0.71.1),我想知道我是否以正确的方式运行该应用程序。我也想知道
react-native bundle
做什么以及为什么我需要它。
我的流程:
但是,我的一些同事在运行
gradlew clean && react-native bundle --platform android --dev false --minify true --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
之前也运行react-native android
。我知道 bundle 命令会创建一个 js 包,并将其他包中的资产打包并放置到 /android/app/src/main/res
文件夹中,但我不明白的是,如果我不运行该命令会发生什么?
如果我使用
react-native run-android
,它是否使用由 bundle
命令添加的包和资产?如果不是,为什么run-android
不将资产添加到android/app/src/main/res
文件夹?然后我会错过在模拟器上启动的应用程序中的资产,还是它们仍然包含在内?
我不使用
react-native bundle
命令的原因是如果我使用react-native bundle
命令,我们的构建服务器会抱怨因为有重复的资产,所以我需要清除已经被bundle填充的drawable文件夹命令。假设我需要使用 bundle 命令,我该如何修复这个错误?