13

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.

1 Answer 1

3
+25

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.

Sign up to request clarification or add additional context in comments.

1 Comment

in rn 0.35, the getJSBundleFile() had been removed from ReactActivity. so you need to implement getJSBundleFile() and/or getBundleAssetName in implementation of ReactNativeHost(), typically in your customized application

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.