Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android 生成bundle的hash值似乎和android studio build出来的bundle的hash值不一致, 导致安装的第一次会进行热更新 #103

Open
JackClown opened this issue Feb 27, 2024 · 1 comment

Comments

@JackClown
Copy link

Thanks so much for filing an issue or feature request! We will address it as soon as we can. Please follow these guidelines:

  1. This repository is for the CodePush CLI and management SDK. For issues relating to the CodePush client SDK's, please see:
  1. In your description, please include the version of code-push-cli or code-push that you are using.

react-native: 0.73

请问有遇到过这种情况吗

@JackClown
Copy link
Author

记录一下解决过程, 给有需要的同学, react native版本0.73

关于源代码相同情况下code-push-cli生成的bundle与xcode或者android编译生成的bundle不一致

以下code-push-cli特指@shm-open/code-push-cli

  • 启用hermes的时候,生成packager bundle的时候,不需要压缩, 所以code-push-cli需要加上参数--minify false
  • code-push-cli需要根据Podfilehermes_enabled来判断是否开启hermes,但当前版本的react native已经不是根据这个参数来了,需要手动加上
  • android build的时候packager生成的sourcemap名称是index.android.packager.map,因此需要给code-push-cli加上参数--sourcemap-output
  • ios build的时候默认不生成sourcemap,但在不开启sourcemap的情况下hermers编译器生成的bytecode会随着bundle的路径不同而不同,开启sourcemap后,又与bundle的路径无关,真的令人匪夷所思,所以解决方式就是生成sourcemap,做法就是在xcode.env内导出环境变量SOURCEMAP_FILE
export SOURCEMAP_FILE="$DERIVED_FILE_DIR/main.jsbundle.packager.map"

但是xcode编译完后,又会删除sourcemap,而code-push-cli会保留sourcemap并且会上传热更新服务器,这又会触发第一次热更新,调整就是不让code-push-cli上传sourcemap,而且确实没有必要

  • code-push-cli默认会上传CodePush目录下的所有文件, 因为如果我们要生成sourcemap,就不要把sourcemap放在CodePush下面

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant