tsb*_*tsb 13 android reactjs react-native
我需要将Entry文件路径更改为src/XXXApp.android.js,而不是指向默认的index.android.js文件.我想将JS文件保存在单独的./src文件夹中.
所以,我提出在改变./android/app/build.gradle像
project.ext.react = [
bundleAssetName: "src/XXXApp.android.bundle",
entryFile: file("../../src/XXXApp.android.js"),
root: "../../../../",
inputExcludes: ["android/**", "./**"]
]
Run Code Online (Sandbox Code Playgroud)
并在.\node_modules\react-native\react.gradle文件中
def bundleAssetName = config.bundleAssetName ?:"src/XXXApp.android.bundle"
def entryFile = config.entryFile ?: "src/XXXApp.android.js"
Run Code Online (Sandbox Code Playgroud)
但是开发包服务器总是指向localhost:8081/index.android/bundle..手动我尝试了URL:localhost:8081/src/XXXApp.android.bundle并检索数据.但是在设备调试中,loadJs总是尝试使用localhost:8081/index.android/bundle.
请分享解决方案,适当的地方更新android的入口文件配置.提前感谢您的宝贵解决方案.
在 MainActivity 中,您可以重写 ReactActivity 的 getJSBundleFile() 方法。您可以在此处指定捆绑包文件名和路径。代码推送使用相同的方法覆盖reactjs包路径。
| 归档时间: |
|
| 查看次数: |
1900 次 |
| 最近记录: |