question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

APK file is larger with react-native 0.59

See original GitHub issue

🐛 Bug Report

After building my arm APK, I noted that APK file increased by about 3 MB. With Android Studio, I analyzed that APK I found two unstripped .so files, libjsc.so and libc++_shared.so, they respectively size 12.7MB and 5.7MB.

To Reproduce

npm install then unzip -l node_modules/react-native/android/com/facebook/react/react-native/0.59.2/react-native-0.59.2.aar

Expected Behavior

These two files must be stripped to reduce their size and, so, to reduce APK file size.

Code Example

Screenshot from 2019-03-26 16-45-12

Environment

React Native Environment Info:
    System:
      OS: Linux 4.18 Ubuntu 18.10 (Cosmic Cuttlefish)
      CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
      Memory: 160.84 MB / 15.39 GB
      Shell: 4.4.19 - /bin/bash
    Binaries:
      Node: 8.11.4 - /usr/bin/node
      Yarn: 1.12.3 - /usr/bin/yarn
      npm: 6.9.0 - ~/.npm-global/bin/npm
    SDKs:
      Android SDK:
        API Levels: 23, 25, 26, 27, 28
        Build Tools: 23.0.3, 27.0.3, 28.0.3
        System Images: android-23 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom
    npmPackages:
      react: ^16.4.1 => 16.8.5 
      react-native: ^0.59.2 => 0.59.2 
    npmGlobalPackages:
      create-react-native-app: 2.0.2
      react-native-cli: 2.0.1
      react-native-git-upgrade: 0.2.7
      react-native-rename: 2.2.2

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
mannodermauscommented, May 10, 2019

We are seeing a similar size increase (around 4 MB for us) after upgrading from React Native 0.57.8 to 0.59.5. Comparing, for instance, lib/x86/libjsc.so in both versions yields the same observations that @Thebarda made; the newer version seems to not be stripped.

0.57.8 (File size: 4614240 bytes): Screen Shot 2019-05-10 at 13 03 16

0.59.5 (File size: 12704300 bytes): Screen Shot 2019-05-10 at 13 02 52

1reaction
Thebardacommented, May 3, 2019

@sridhar-vadlamani-ck Do you splits your application into multiple APK ? Splitting you app into an APK for each architecture could reduce that increase. The big advantage of the new 0.59 is that you can generate an APK for 64-bit architectures

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native initial App size is too large - Stack Overflow
Using Android App Bundle(aab) will slightly reduce apk size (>=8Mb). To generate Android App ... APK file is larger with react-native 0.59.
Read more >
Releasing React Native 0.59
Lean core is underway​ ... React Native is a large and complex project with a complicated repository. This makes the codebase less approachable ......
Read more >
Make your React Native app 3x smaller with one simple ...
It also means that if you are upgrading to 0.59 your APK size will grow by roughly 10MB. In this article we show...
Read more >
Optimising React Native APK Size - Medium
Android App apk size and App performance has always been a major concern for React Native Developers. And our app being written in...
Read more >
Upgrade to React Native 0.59 - Matt Oakes
properties file. You can also remove the wrapper Gradle task. This no longer required as it duplicates the Gradle version setting. buildscript {...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found