Reputation: 1711
I'm a newbie on React Native and I'm building an app for my company. We must publish the app on the Google Play Store: I've had lot of experience while developing in pure Java or with Flutter framework, and everything has always worked. The problem is that when I run a gradlew assembleRelease
from the android folder, the app build successfully, however if I install the apk in the device, I don't see it in the apps list and I can't start the app. Moreover, if I launch the application with npx react-native run-android --variant=release
, the app starts (still don't see it in the apps list), but the Metro bundler doesn't attach to the app, and the app itself doesn't work (I'm stuck in the login screen and nothing happens).
I'm sorry, I can't get you code or screenshots, but what I can say is that from the other side, iOS, everything works fine, and everything works fine when i run npx react-native run-android
without the release flag.
Any suggestion?
Upvotes: 0
Views: 965
Reputation: 1711
I found a solution googling the entire internet and merging the comments!
From the root folder you need to run this command:
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle
This will bundle all the files that the application needs in the android folder, so the next run of react-native run-android --variant=release
will work.
Maybe they could add this to the official docs
Hope this helped!
Upvotes: 2