How to use offline bundle on android for react native project?

后端 未结 6 2087
野性不改
野性不改 2020-11-30 19:38

How to use offline bundle on android?
I didn`t see the document about use offline bundle on android.
I tried to uncomment the code in build.gradle.



        
6条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-30 19:51

    You can override getJSBundleFile() function in your ReactApplication class to return a custom file path.

    @Nullable
        @Override
        protected String getJSBundleFile() {
            return "/your/bundle/path/bundle.file.name.bundle";
        }
    

    After that, just generate the bundle using react-native bundle, then put the generate bundle in the specified path in your device.

提交回复
热议问题