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 :
@notbrent
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 �
or what?
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.
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 Reducing App Size | Voters | Expo - 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: addUnimodulesDependencies([exclude: ['expo-face-detector']])
So if I understand correctly, you replace the following line that you already found: