react-native pod install 失败问题汇总

最新版0.76.3报错 …

这个具体的报错信息没给,参考

https://github.com/facebook/react-native/issues/34189

Debugging this issue on my M1 mac, I discovered that I had never set my git config to use the correct line endings for *nix on macOS. UPDATE: I had actually forgotten to unset them after working with a repo with Windows line endings. This means they were set to git config --global core.autocrlf true which is the setting for windows.

This is the correct setting for linux/mac.

git config --global core.autocrlf input

You can also unset them and use the default which is false

git config --global --unset core.autocrlf

After this, you will need to normalize all the line endings in the project (unless you want to re-clone).

https://stackoverflow.com/a/13154031

After you have done the configuration, you might want git to normalize all the files in the repo. To do this, go to to the root of your repo and run these commands:

git rm --cached -rf .
git diff --cached --name-only -z | xargs -n 50 -0 git add -f

If you now want git to also normalize the files in your working directory, run these commands:

git ls-files -z | xargs -0 rm
git checkout .

There are some .bat files for windows that you will not want to change, so discard those.

Once you have done these steps, you shouldn’t need any of the custom workarounds in this thread.

Originally posted by @shwanton in https://github.com/facebook/react-native/issues/34189#issuecomment-1502532287

阅读更多

react-native-config 配置多包名&多环境 APKs 共存

以前都是准备几台不同的 android 手机安装不同环境的包,如果想一个手机安装不同环境的包,只能删了重新打然后重新安装。
解决问题的根本原因是,构建不同环境的包,假设我有三个环境

- Staging -> .env.Staging -> com.duolegamehelper.staging
- Alpha -> .env.alpha -> com.duolegamehelper.alpha
- Production -> .env.production -> com.duolegamehelper.production

那么我就打包的时候,通过不同的.env配置文件,动态的把包名和 APP 的名字打进去。
研究了半天,其实react-native-config是可以解决这个问题的,只不过需要修改打包的gradle脚本。

Snipaste 2024 02 11 15 10 28

阅读更多