I need to change the Entry file path to src/XXXApp.android.js instead of pointing to default index.android.js file. I want to keep the JS file in seperate ./src folder.
So that I made the change in ./android/app/build.gradle like
project.ext.react = [
bundleAssetName: "src/XXXApp.android.bundle",
entryFile: file("../../src/XXXApp.android.js"),
root: "../../../../",
inputExcludes: ["android/**", "./**"]
]
and in .\node_modules\react-native\react.gradle file like
def bundleAssetName = config.bundleAssetName ?:"src/XXXApp.android.bundle"
def entryFile = config.entryFile ?: "src/XXXApp.android.js"
But development package server always pointing to localhost:8081/index.android/bundle. . Manually i tried the URL: localhost:8081/src/XXXApp.android.bundle and it retrieve the data. But in device debug loadJs always try the localhost:8081/index.android/bundle.
Please share the solution, proper place to update the entry file config for android. Appreciate in advance for your valuable solution.
gradle . In Android Studio it's easily changed in the settings (Default settings > Build, Execution, Deployment > Build Tools > Gradle > Service directory path).
index.js is the starting point for React Native applications, and it is always required. It can be a small file that require s other file that are part of your React Native component or application, or it can contain all the code that is needed for it.
In your MainActivity you can override getJSBundleFile() method of ReactActivity. Here you can specify your bundle file name along with the path. Code push use same method of override reactjs bundle path.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With