-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Description
Environment
React Native Environment Info:
System:
OS: macOS High Sierra 10.13.6
CPU: x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Memory: 2.79 GB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.11.1 - /usr/local/bin/node
Yarn: 1.0.2 - /usr/local/bin/yarn
npm: 6.1.0 - /usr/local/bin/npm
Watchman: 4.7.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3
Android SDK:
Build Tools: 23.0.1, 23.0.2, 24.0.0, 24.0.1, 24.0.2, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 27.0.1, 27.0.3
API Levels: 23, 24, 25, 26, 27
IDEs:
Android Studio: 3.1 AI-173.4907809
Xcode: 9.4.1/9F2000 - /usr/bin/xcodebuild
npmPackages:
react: ^16.5.0 => 16.5.1
react-native: ^0.57.0 => 0.57.0
npmGlobalPackages:
create-react-native-app: 1.0.0
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7
Description
This has been an issue for a long time, however, we've put up with it until now.
When following the official guide on generating release builds for Android (https://facebook.github.io/react-native/docs/signed-apk-android), we correctly generate a signed APK at android/app/build/outputs/apk/${flavorName}/app-${flavorName}.apk
, however, the app crashes on launch as there are no assets included in the APK:
During build, the assets are correctly generated at android/app/build/intermediates/assets/${flavourName}/
, but simply aren't included in the output APK.
Now the workaround, which there seem to be a lot of people using in one form or another, is to copy the contents of android/app/build/intermediates/assets/${flavourName}/
to android/app/src/main/assets/
and generate the APK again (either through $ ./gradlew assembleRelease
or Android Studio, it makes no difference).
A lot of people have put up with this as an issue by running $ 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/
manually before running assembleRelease
, which simply outputs the generated assets in the folder I mentioned above.
The question is, why aren't the assets generated during the build process (the ones found in android/app/build/intermediates/assets/${flavourName}/
), included in the APK?
This is what the APK should look like:
Like I say, this has been a long term issue for us, and we're not on the latest version of react native but there have been no changes to the react.gradle
since 0.53. I will of course test the latest version all the same.
EDIT: Upgrading to 0.57 this is still an issue