Reputation: 938
I'm using react-native, and everything was working well while I was developing, but, when I built the APK (using this tutorial: https://facebook.github.io/react-native/docs/signed-apk-android.html#content) and installed it on my device, the app shows just a blank page.
Did anybody had the same issue?
Edit:
I looked at the log on the device, and this is the error:
11-09 22:00:51.115 16525 16525 W unknown:React: You seem to be running on device. Run 'adb reverse tcp:8081 tcp:8081' to forward the debug server's port to the device.
11-09 22:00:51.115 16525 16525 W unknown:React: You seem to be running on device. Run 'adb reverse tcp:8081 tcp:8081' to forward the debug server's port to the device.
11-09 22:00:51.198 16525 16555 E ReactNative: Got JS Exception: SyntaxError: Unexpected token ':'. Parse error.
Thanks.
Upvotes: 2
Views: 4270
Reputation: 155
I guess you are looking for how to generate signed apk.
it seem you did not have a react.gradle file under android/app: you can bundle the JavaScript package and drawable resources manually by doing the following in a terminal:
$ mkdir -p android/app/src/main/assets
$ react-native bundle --platform android --dev false --entry-file index.android.js \
--bundle-output android/app/src/main/assets/index.android.bundle \
--assets-dest android/app/src/main/res/
$ cd android && ./gradlew assembleRelease
after following this process app.release.apk will be under android\app\build\outputs\apk directory.
Upvotes: 0
Reputation: 938
Ok I solved the issue by running the following command before building:
curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"
Upvotes: 1