Commit Graph

3 Commits

Author SHA1 Message Date
Martin Konicek abb81eb270 Add support for split build per architecture
Summary:
This allows everyone to deploy significantly smaller APKs to they Play Store by building separate APKs for ARM, x86 architectures.

For a simple app, a release APK minified with Produard:
- Universal APK is **7MB**
- x86 APK is **4.6MB** (34% reduction)
- ARM APK is **3.7MB** (47% reduction)

Created a sample project, uncommented `// include "armeabi-v7a", 'x86'`:

    cd android
    ./gradlew assembleDebug

Three APKs were created, unzipped each: one has only x86 binaries,
one has ARM binaries, one has both.

    ./gradlew assembleRelease

Three APKs were created, JS bundle is correcly added to assets.

    react-native run-android

The correct APK is installed on the emulator and the app runs fine
(Gradle output: "Installing APK 'app-x86-debug.apk'").

With the line commented out the behavior is exactly the same as before,
only one universal APK is built.

Checked that version codes are set correctly as described in
http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
http://developer.android.com/intl/ru/google/play/publishing/multiple-apks.html

Closes https://github.com/facebook/react-native/pull/5160

Reviewed By: svcscm

Differential Revision: D2811443

Pulled By: mkonicek

fb-gh-sync-id: 97b22b9cd567e53b8adac36669b90768458b7a55
2016-01-07 12:03:06 -08:00
DengYun 6124298dd7 bugfix part 1 for #4124: react.gradle cause a error on windows when building release apk.
Summary: ```
* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> A problem occurred starting process 'command 'react-native''
```

Can be solved by this patch.
Closes https://github.com/facebook/react-native/pull/4209

Reviewed By: svcscm

Differential Revision: D2669661

Pulled By: foghina

fb-gh-sync-id: 951b7eb9dd3121de607cf5eb3dfb3af44cdf5994
2015-11-18 12:23:28 -08:00
Felix Oghină 9dc036d2b9 add gradle tasks for bundling js and assets in template
Summary: This adds gradle tasks that call `react-native bundle` with the correct args to bundle dev/release JS and assets. The dev task is disabled by default, as in dev mode people only use reload JS in most cases.

Submitting this as a pull request to have community visibility, although we have this code internally as well now and this will require an import.

* generate a project with `react-native init`, add some assets, run `./gradlew assembleRelease`, sign & zipalign generated APK, run it -> works
* enable dev bundling task, run `./gradlew installDebug` (not `react-native run-android` so as to not start the packager) -> works

Reviewed By: svcscm

Differential Revision: D2555071

Pulled By: foghina

fb-gh-sync-id: c3d9fcd4c77862e6a4db4e4d8d8cc39ee9dff3ab
2015-10-19 06:33:22 -07:00