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

后端 未结 6 2086
野性不改
野性不改 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:49

    For release with a Signed APK.

    I tried using an unsigned APK file and installing that, but when I went to install it on my Android tablet, it gave me an error of Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES].

    I imagine this is because the APK file wasn't signed and the tablet was not happy with this. So, after generating the React Native bundle file I was able to generate a signed APK file, as normal, via Android Studio.

    By the way, our app is a fully functioning Android app that already exists in the Play Store and we are just adding React Native to it in bite-sized pieces, because it's awesome.

    So to summarize, here were my steps:

    1) Generate React Native bundle:

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

    2) Generate a Signed APK file from Android Studio.

    3) Install Signed APK File to USB device:

    adb -d install -r  
    

    4) Profit!

提交回复
热议问题