如何远程加载 react-native(Android) 包 [英] How to load react-native(Android) a bundle remotely

查看:69
本文介绍了如何远程加载 react-native(Android) 包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的 APP 中使用 react-native Android 创建了一个 android 模块,就我而言,我试图远程加载一个 JS 包文件,但它总是从本地主机加载,我看到包位置的配置是硬编码的在DevServerHelper.java中,我APP的assets文件夹中的bundle文件在APP运行时是只读的,所以我无法动态修改.

I created an android module in my APP with react-native Android, In my case, I am trying to load a JS bundle file remotely, but it's always loading from localhost, and I see the config to bundle's location is hard coded in DevServerHelper.java, the bundle file in my APP's assets folder is read-only when APP running so I can't modify it dynamically.

那么我可以远程加载捆绑文件吗?如果没有,我如何在 APP 中使用 react-native 实现升级功能?

so can I load the bundle file remotely? If not, how can I implementation an upgrade feature in APP use react-native?

非常感谢!

推荐答案

您可以通过更改 Dev Settings 下的 Debug server host for device 设置来远程加载包愤怒震动菜单.它也在关于 的本机文档中进行了解释如何在设备上运行.

You can load the bundle remotely by changing the Debug server host for device setting under Dev Settings in the rage shake menu. It is also explained in the react native docs about how to run on device.

这篇关于如何远程加载 react-native(Android) 包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆