-
Notifications
You must be signed in to change notification settings - Fork 24.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
APK Size is doubled #23575
Comments
is that because 0.58 support arm64-v8a? |
Was the JSC updated on Android? That'd increase the appSize by ~4mb even with abi splitting. 2x 4 = 8mb increase in universal apk I'd guess. |
@creambyemute This is the MB growth in my case, RN 0.57.8 app size was around |
it's about using JSC |
If you can use Android App Bundle. |
Well, it's not really a bug then. Should this be an issue at all? |
@darekg11 it is not issue. RN 0.58 adds support for ARM v8. RN 0.59 adding x86_64. |
Damn i was wondering why the debug apk was <13 mb since when i used RN 0.56 it was 6 mb.. 6 MB! . I guess its time to generate separate apk files for google play . This should be somewhere in the docs. It was driving me insane, i thought it was my build tools version |
I create a new project with react-native init (RN 0.59) and then generate a signed APK. The APK size is ~30MB what happend?? |
APK always contains support for 3 platforms (ARM, ARM64, X86, X86_64 is not bundled for 0.59.0) and includes new JSC (javascript core). Use AAP (Android App Bundle). It is not a bug. |
This is because of JavaScript Core update. |
Hey all 👋thanks for sending this issue over. The solution provided by @darekg11 is the correct approach. This is also now documented here in a bit more detail. |
Thanks for the documentation. However i think that there should also be documentation of the usage of Android app bundle with android studio and without android studio [using only the command line] |
@LiteKat thanks for the feedback, could you send a PR to the docs with the changes you think are needed as mentioned above |
Thanks |
The thing is, universal apk file is like 27mb now, which was around 7mb before for a clean react-native project. Before latest updates it was around 7mb while it was supporting both |
Same issue. RN 57 app size was 9mb and now (RN 59.9) around 20mb. What should I do? |
when upgrading to rn 59 I removed this code from
my app size went up to 54MB.
I found out there are lots of platforms that I don't want, including
then app size reduced to 22MB. |
Hi, I followed this document App size is huge. This is not acceptable. We have developed a True Native App on android which has lots of features and the app size is 7mb. |
@arjun-livquik what do you measure? File size of generated Only right measurement is looking for final size after shrining in Google Play. |
@radeno,
Thanks @radeno |
You can also give hermes engine a try. |
After enabling Hermes. This is great. I checked my new apk of actual app. It's reduced significantly.
|
Publishing to other storesBy default, the generated APK has the native code for both x86 and ARMv7a CPU architectures. This makes it easier to share APKs that run on almost all Android devices. However, this has the downside that there will be some unused native code on any device, leading to unnecessarily bigger APKs. You can create an APK for each CPU by changing the following line in android/app/build.gradle:
Upload both these files to markets which support device targeting, such as Google Play and Amazon AppStore, and the users will automatically get the appropriate APK. If you want to upload to other markets, such as APKFiles, which do not support multiple APKs for a single app, change the following line as well to create the default universal APK with binaries for both CPUs.
Enabling Proguard to reduce the size of the APK (optional)Proguard is a tool that can slightly reduce the size of the APK. It does this by stripping parts of the React Native Java bytecode (and its dependencies) that your app is not using.
To enable Proguard, edit android/app/build.gradle:
All details see Official file Hope it can help you. |
Enabling Hermes will significantly reduce app bundle size. |
🐛 Bug Report
The APK size is almost doubled in RN 58. In RN 57 the release build of the app was about ~8mb. Now it's ~16mb.
To Reproduce
Create a new project with
react-native init
and then generate a signed APK using this.Expected Behavior
~8mb APK size.
Environment
React Native Environment Info:
System:
OS: Windows 10
CPU: (4) x64 Intel(R) Core(TM) i5 CPU 760 @ 2.80GHz
Memory: 1.58 GB / 7.99 GB
Binaries:
Yarn: 1.13.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.2.0.0 AI-181.5540.7.32.5014246
The text was updated successfully, but these errors were encountered: