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

后端 未结 6 2051
野性不改
野性不改 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 20:09

    When building an unsigned apk from react native project through create-react-native-app which does not have index.android.js and index.ios.js .so first of all you have to check that wheter index.js file is there in your project .if it is not available then create a new file index.js and write this code there

    import { AppRegistry } from "react-native";
    import App from "./App";
    AppRegistry.registerComponent("VOS", () => App);
    

    after this eject the project and then run this command

      react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/
    

    and then react-native run-android so it will build an apk for you.

提交回复
热议问题