Skip to content
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 file size after latest updates (this issue was already reported but they're marked as closed) #24988

Closed
AmyrAhmady opened this issue May 22, 2019 · 15 comments
Labels
Bug Help Wanted :octocat: Issues ideal for external contributors. Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@AmyrAhmady
Copy link

Hey 👋
this issue was already reported multiple times but they're marked as closed.

The thing is, universal apk file is like 27mb now, which was around 7mb before for a clean react-native project.
even they added new architectures support such as arm64-v8a and x86_64, that doesn't mean it should go this much high.

Before latest updates it was around 7mb while it was supporting both armeabi-v7a and x86. and for separated apk files, they were only 3mb and 5mb. but now after these latest updates they all changed and now even x86 and armeabi-v7a are more than 7mb (which was the universal apk file size!)

Might be helpful if someone who knows what to do to reduce release builds file size help us with it so others can find a way for it.
Yes I know you can generate separated apk files for each architecture. but they have bigger file size now as well, like I mentioned above.

related issues:
#24763
#23575

@AmyrAhmady AmyrAhmady added the Bug label May 22, 2019
@react-native-bot
Copy link
Collaborator

Thanks for submitting your issue. Can you take another look at your description and make sure the issue template has been filled in its entirety?

👉 Click here if you want to take another look at the Bug Report issue template.

@react-native-bot react-native-bot added Ran Commands One of our bots successfully processed a command. Resolution: Needs More Information labels May 22, 2019
@janicduplessis
Copy link
Contributor

I'm not sure exactly what caused the size increase but we did update JSC and added new architectures so it could be related to this. There might also be a regression and things we can improve so if someone can investigate what is causing the APK size to have gone up that would be great.

In the meantime I suggest looking at https://developer.android.com/platform/technology/app-bundle to ship more optimized bundles, this will help remove the extra architectures that were added.

@janicduplessis janicduplessis added the Help Wanted :octocat: Issues ideal for external contributors. label May 22, 2019
@AmyrAhmady
Copy link
Author

AmyrAhmady commented May 23, 2019

Just to let you know, on RN 0.58.6 which only supports armeabi-v7a and x86 (means new architectures support wasn't even there to cause the size increase), release build file is +16mb (talking about universal app)
things that changed after 0.57.x version:

buildToolsVersion = "28.0.2"
compileSdkVersion = 28
targetSdkVersion = 27
supportLibVersion = "28.0.0"

it used use 27 ver on 0.57.x

and also about gradle stuff:

dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        ..........
}
...
...
task wrapper(type: Wrapper) {
        gradleVersion = '4.7'
        ..........
}

which used to use com.android.tools.build:gradle:3.1.4 and gradleVersion was 4.4 back then on 0.57.x

I just compared 0.57.x with 0.58.6, things I mentioned are changed in 0.59 as well.
Don't know if these stuff can cause the size increase, just some info that might be helpful

@radeno
Copy link
Contributor

radeno commented May 23, 2019

You can use Analyze APK in Android Studio to see how native packages changes size and which ones are significant.

@lsancheztapia
Copy link

Is this solved ?

@dulmandakh
Copy link
Contributor

Please use App Bundle, see https://developer.android.com/platform/technology/app-bundle

@lsancheztapia
Copy link

Using App Bundle doesn't reduce significantly the size of the output file, for a clean project I have an .apk with size around 31MB, and compiling with : ./gradlew bundleRelease I get .aab with size around 28MB

@radeno
Copy link
Contributor

radeno commented Jun 17, 2019

@lsancheztapia it doesn't matter how large is AAB. It is distribute for every platform independent. If you build it for 4 platform support. You should divide final size by 4 in average.

@AmyrAhmady
Copy link
Author

@radeno which is still too much? and apk for each architecture has a size around 10mb, so its not just dividing by 4.
RN 0.57.x was supporting two architectures only and the universal apk was only 7mb
4mb for x86 and 3mb for arm7

and why is this issue closed? we are not even closed to solved status.
And no one knows the actual reason yet

@radeno
Copy link
Contributor

radeno commented Jun 17, 2019

@AmyrAhmady APK before RN 0.58 apps were builded for 2 platforms. So you uploaded two binary support in one APK. We should say it is 10MB size as base default.
RN 0.58 added support for X86_64 and RN 0.59 for ARM 64bit. So with RN 0.59 you are building for 4 platforms, and with RN 0.57 for two platforms.

So if size with RN0.57 was 10mb, with RN0.59 it is about 20MB. which is corrent. But another Change. RN 0.57 has very old JSC and RN0.59 brings totally new JSC which is bigger.

So larger APK or AAB is fine and correct.

@AmyrAhmady
Copy link
Author

AmyrAhmady commented Jun 19, 2019

@radeno wrong.
RN 0.59 generates universal APK with ~30mb file size, but each one as a separated architecture will be 10mb, keep that.
RN 0.57 generates universal APK with ~7mb file, but for each platform it will be 3mb and 4mb, keep that too.

RN 0.57 supports x86 and armeabi-v7a only while RN 0.59 supports arm64-v8a and x86_64 too, which means it supports arm64-v8a, x86_64, x86 and armeabi-v7a, keep that as well.

so now here we are, lets compare them with each other:

RN 0.57 - x86 platform output -> 4.7mb | armeabi-v7a ->3.5mb
RN 0.59 - x86 platform output -> ~10mb | armeabi-v7a ->~9mb | other platforms are not in this list, cause there's nothing to compare with

As you can see, only for those two platforms which are totally the same:
4.7mb < ~10mb and 3.5mb < ~9mb.

so now what you are saying is basically, its JSC fault, which shouldnt come up with that much difference.

@radeno
Copy link
Contributor

radeno commented Jun 19, 2019

@AmyrAhmady

I don't have energy to explain. Look at this chart:
https://user-images.githubusercontent.com/46429/58716048-cadc2b00-83fa-11e9-99d5-a91af1e9d0f6.png

Red is RN0.57 JSC, Blue is RN0.59 JSC. Difference in size is about 5.3MB.

4,7 + ~5,3 ~= 10MB
3,5 + ~5,3 ~= 9MB

So?

@pedrosimao
Copy link

Ok, I understand the size of APK doubles because of 64 bit version. The problem is that my APK has more than 100mb (before 0.59 update it was a bit over 50mb. And because of this Google Play Sotre no longer accepts my APK saying it is too large. What should I do? After long hours updating 0.59 and all library incompatibilities, I can't publish my app. This is really frustrating.

@radeno
Copy link
Contributor

radeno commented Jun 19, 2019

@lsancheztapia
Copy link

Ok, I understand the size of APK doubles because of 64 bit version. The problem is that my APK has more than 100mb (before 0.59 update it was a bit over 50mb. And because of this Google Play Sotre no longer accepts my APK saying it is too large. What should I do? After long hours updating 0.59 and all library incompatibilities, I can't publish my app. This is really frustrating.

Maybe you have to use : https://developer.android.com/studio/projects/dynamic-delivery#customize_delivery , I don't know if RN supports it.

@facebook facebook locked as resolved and limited conversation to collaborators Jun 17, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jun 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Help Wanted :octocat: Issues ideal for external contributors. Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

7 participants