Repository navigation
Description
Description
APK Size got increased almost double after upgrading to React Native 0.66.0
OLD APK Size: 18Mb
NEW APK Size: 41Mb
Version
0.66.0
Output of react-native info
info Fetching system and libraries information...
System:
OS: macOS 10.15.6
CPU: (4) x64 Intel(R) Core(TM) i5-5350U CPU @ 1.80GHz
Memory: 33.75 MB / 8.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 14.15.0 - /usr/local/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 7.16.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: Not Found
SDKs:
iOS SDK: Not Found
Android SDK:
API Levels: 23, 25, 26, 27, 28, 29, 30
Build Tools: 23.0.1, 25.0.3, 26.0.1, 28.0.2, 28.0.3, 29.0.2, 29.0.3, 30.0.2
System Images: android-26 | Google Play Intel x86 Atom, android-29 | Google APIs Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: 4.1 AI-201.8743.12.41.6953283
Xcode: /undefined - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_201 - /usr/bin/javac
Python: 3.8.5 - /Users/nj/opt/anaconda3/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.66.0 => 0.66.0
npmGlobalPackages:
react-native: Not Found
Steps to reproduce
Upgrade to react native latest version
Build APK.

Activity
github-actions commentedon Oct 22, 2021
react-native infoin a console.Smiche commentedon Nov 9, 2021
Similar experience here after upgrading from react-native 0.64 to 0.66

cortinico commentedon Nov 9, 2021
What's your
minSdkVersion? By any chance have you bumped from 21 to 23?Smiche commentedon Nov 9, 2021
minSdkVersion 24 and have not changed it while upgrading react-native.
shubhamdeol commentedon Nov 11, 2021
I am also facing similar issue. App size on Playstore increased from 12 mb to 25 mb.
shubhamdeol commentedon Nov 12, 2021
@cortinico can it be due to all libraries staring to support api 30 from 29 ?
cortinico commentedon Nov 12, 2021
So what could have happened is that in your bump, the minSdk version got moved from 21 to 23 (or above).
The change could have been imposed by one of the transitive dependency in your project.
React Native is specifying minSdkVersion 21, but if any of your library or your project is specifying a higher number, that will prevail.
Specifically with api lvl 23, the native libraries are uncompressed in the APK, resulting in the an apparent bigger size of the APK (see here https://stackoverflow.com/a/63417612).
The best to investigate this is if someone could create a reproduce on Github, adding a base commit on RN 0.64 and a subsequent commit with the bump to 0.66. That would greatly help investigate what happened.
github-actions commentedon Nov 12, 2021
1 remaining item
cortinico commentedon Jan 6, 2022
From which version are you migrating from @anirudhagarwal1
anirudhagarwal1 commentedon Jan 6, 2022
I am upgrading from 0.63.4.
Also one more question. The above screenshot is of a release build, then why do I see some debug .so files(for ex: libhermes-executor-common-debug.so)? Is that expected?
liamjones commentedon Jan 6, 2022
This is also what we experienced upgrading from 0.63.4 to 0.66.3 too - about 6MB of new libs (including hermes/debug ones in non-Hermes release builds).
cortinico commentedon Jan 6, 2022
Nope is not. The
react.gradlescript has a specific section for removing the .so that are not relevant to your build. Specifically:https://github.com/facebook/react-native/blob/a03bd2f13ed9d20f4c82ae1e73a4afa281fe2e9a/react.gradle#L360-L379
The best would be to try on an empty project on RN 0.66.0 and verify if it's working correctly or not.
liamjones commentedon Jan 6, 2022
Yep, doesn't look like it's working:
anirudhagarwal1 commentedon Jan 6, 2022
@cortinico Do you need anything else from my end to help you debug the issue?
cortinico commentedon Jan 7, 2022
Nope, thanks for the input 👍. I was able to reproduce, and the bug is effectively there on
0.66.0. I've also tested on0.67.0-rc.6and the regression got already fixed.From @liamjones command, running on 0.67:
The fix is most likely this #32257 which haven't been included in 0.66.0. Given that 0.67 is really close to be released, I think we should be good to go with that.
Should there be blockers for 0.67.0, we can consider backporting #32257 to a point release for 0.66.x
Closing as this was essentially resolved. Feel free to re-open or comment if needed 👍
EDIT: typo
ursnj commentedon Feb 12, 2022
This issue not resolved in 0.67 also, im seeing same bundle size with newer version also.
weihangChen commentedon Feb 15, 2022
after upgrading from 0.66 to 0.67 it went down for 30MB, but there is still a 40MB up compared to previous version. But I did have android minsdk bumped from 21 to 23, as others suggested, it also contributes to the increases of size
mokshmodi96 commentedon Jun 6, 2022
I bumped my minSdkVersion to 23 from 21 and apk size doubled but i found a workaround-ish on stackoverflow linked below here