Hi the stand alone apps are getting bigger and bigger with each sdk update of course for adding more features.I know about App Bundle and stuff but the .apk of an empty project created with sdk 36 is 48mb.
as you can see.And that is a big problem.So are you planning on finding a way to get around this issue?I ejected the app also.But well all of the unimodules are added.and I should remove those modules.Which isn’t a really great option.(Though that was the first time I ejected I don’t know a lot about ejecting and how to get rid of unused modules yet).
Just created an apk with android studio from the ejected project and got a 22mb apk.Which is still not acceptable for an empty project in the gradle.app there is :
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.facebook.react:react-native:+" // From node_modules
From what I guess is adding all the unimodules to the app.So how do I even remove those that I don’t need?
@stevemoretz - there are only a few expo libraries added when you have a bare project. we can’t analyze your own binary for you but you can look at a tool like apk analyzer if you want to get more insight https://developer.android.com/studio/build/apk-analyzer
Hi thank you for the reply.Did you notice I ejected it into bare?Not create it in bare.Does that make it 22mb?For instance I’m getting all these libraries.
Thanks again for the reply,just to make it clear:The main question is are you working on making the modules optional?48 mb for an empty app.Sounds like a disaster.
But my next question is well that is what I get after ejecting so how do I get rid of modules I don’t need now?
react-native unlink …?
you can exclude any of those libraries if you need to as explained under “Need to exclude some unimodules that are being automatically linked?” in the readme here: https://github.com/unimodules/react-native-unimodules
the libraries listed there will have a minimal impact on your apk size. additionally, you would never ship an apk these days, you should always ship an aab.
again i’d encourage you to run apk analyzer to see where the file weight is coming from. it could easily be 5 large images in your app and/or a bunch of fonts bloating it.
Thank you yeah sure I know but some customers want apk too.Thanks for all those explaination.
where shall I put :
And would you please answer my first question?Do you have any plans for future support of disable modules without ejecting?Anything in progress?Please give us a clue thank you so much.
you can only use that in ejected projects, and by default face-detector is not included in ejected projects, it’s only there if you install it explicitly. in managed projects currently we include everything.
we do have plans to let users opt-out of some apis in managed workflow standalone apps. there is a good amount of work that needs to be done to make this good, because otherwise we’re making it easy for folks to deploy broken apps to production, eg: if you did a build without expo-camera, then did an ota update to use expo-camera, the native code necessary for it wouldn’t be there. in this case we would need to either prevent you from doing it, warn you about it, or that type of thing.
you can track our progress on reducing app size in https://expo.canny.io/feature-requests/p/reducing-app-size - we will post updates there as we have them. until then, if a lean app is crucial for you then you will want to eject your project.
Thank you so much for explaining everything in great detail.I know I can only use that in ejected projects of course,but what I was asking,was would you please tell me where to put this line?I mean in which file?
Thank you for the Feature Request link.Now we’re sure that it’s going to happen which is awesome,of course it will take some time as you mentioned and we all know.It could create a lot of bugs,it needs thinking and planning.But you’ve done a great job till here (almost unbelievable what expo does) and we know you can pass these steps too.We all wish you luck keep up the great work.
I have not tried this myself yet, but after having a look at the documentation I think you’re mixing up the instructions for iOS and Android. If you look under the Configure Android section there’s another “Advanced configuration” section with the following instructions:
If you need to exclude some of the unimodules that you are not using but they got installed by your other dependencies (like
expo ), then you can pass in
exclude param for this. For example, if you want to exclude
expo-face-detector , you may want to use this:
So if I understand correctly, you replace the following line that you already found:
with something like this:
You are totally right.Thank you so much.
That’s not true.
Many of us have to ship apk because we don’t use app stores or google play to distribute our apps.
In Asia, where app size is extremely important, it’s common to distribute from your own website.
You’re right.But he said they’re working on it,To make the packages optional so that’s good news.Hoping so it’ll come out very soon.
This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.