我需要将条目文件路径更改为src/XXXApp.android.js而不是指向默认的index.android.js文件。我想将JS文件保存在独立的./src文件夹中。React Native:将条目文件路径index.android.js更改为指定的自定义文件路径
所以,我在./android/app/build.gradle所做的更改像
project.ext.react = [
bundleAssetName: "src/XXXApp.android.bundle",
entryFile: file("../../src/XXXApp.android.js"),
root: "../../../../",
inputExcludes: ["android/**", "./**"]
]
和。\ node_modules \反应母语\ react.gradle文件中像
def bundleAssetName = config.bundleAssetName ?:"src/XXXApp.android.bundle"
def entryFile = config.entryFile ?: "src/XXXApp.android.js"
但是开发包服务器始终指向localhost:8081/index.android/bundle。。手动我试过的URL:localhost:8081/src/XXXApp.android.bundle它检索数据。 但在设备调试loadJs总是尝试localhost:8081/index.android/bundle。
请分享解决方案,适当的地方来更新android的入口文件配置。提前感谢您宝贵的解决方案。
在0.35中,getJSBundleFile()已从ReactActivity中移除。所以您需要在实现ReactNativeHost()时实现getJSBundleFile()和/或getBundleAssetName,通常在您的自定义应用程序中 – gonglong