Hello! I’m just learning to program with Solar2D, and I can’t understand why the apk file (Hello World) from the examples has such a huge size - 11.8MB. Please tell me what tools can be used to reduce its size?
I think that most of that size is engine itself.
Thanks for the answer. To tell the truth, this situation does not please me at all.
when corona sdk was there before solar2d, empty apps used to have an apk size of 6MB or less
as playstores evolve, and SDKs evolve, initial plugins need to exist even if you don’t have any line of code, that’s why it keeps growing
Unity for example exports to a much larger size for empty apk
it’s all about default plugins, and additional plugins in your code
Thanks. I’m wondering if there are any third-party tools to reduce the size of the apk? Or are there no options at all to reduce the size of the empty Solar2D application?
You can reduce the size by a bit over 1MB by removing the standard widget_asset graphics that are added on build. Excluding them should really be a part of the build system by now and I think it can be done with HTML5 builds already. For Android, you’d need to manually take them out and it’s not something I’d recommend doing for how little the gains are.
Is there something that’s worrying you about the APK size @Impad?
Actually, it worries. I have been programming for a long time. And for microcontrollers, and for Windows. And the size of the application always makes sense, sometimes critical. The smaller the app, the better. And bloated monsters, despite the fact that they still do nothing, few people will like. Sorry to be straightforward. I wanted to learn how to program for Android, but apparently I chose the wrong environment.
@Impad My knowledge on this may be a bit off, but the size doesn’t come from plugins, like @kakula mentioned. All plugins are only added if they are explicitly included in the
build.settings file. Based on my understanding, @kakula is correct that the apk size does increase to keep up with SDK and app store updates.
Take Unity, for example, I’ve read forum posts from 2013 how empty projects were 6-7MB and how in 2017 an empty project turned out to be around 20MB. I’m not sure what size they are now.
In case of Solar2D, adding support for 64-bit Android meant that the apks now come packed with the necessary bundles required to run it on both 32 and 64-bit devices. This resulted in quite a big bump in the size. From my understanding, supporting things like armeabi, armeabi-v7a, x86, etc. all come with around 2-3MB bump in size.
However, the size of the apk doesn’t necessarily tell the whole truth. When you build for Android, you get an apk and an aab file. If you upload this aab file to Google Play, then the actual apk size may be drastically smaller. I think I remember reading at some point how native react apks were over 20MB, but they dropped to below 10MB if you uploaded an aab to Google Play instead of the apk.
Still, you know what is best for you and your project. Just remember that using any engine will come with its required elements. If you really want to go for small apks, then you should go with Java and write native apps. You’ll get as small apks as you want, but you won’t have any of the engine specific niceties that Solar2D, Unity, Godot, Löve, Delfold, etc. bring with them.
Yes I understand this. I was bribed by a fantastically fast simulator in Solar2D. And also the simplicity of the LUA language. But the size of the apps is killing. I don’t know what to do next …
I wouldn’t worry about this so much. You can’t control it, and you are focusing on the wrong thing.
You should be more concerned about:
- Is this SDK easy to learn and use?
- Can it do what you need?
- Can it target the platforms you want to hit?
Corona/Solar 2D doesn’t approach base executable size like some other SDKs/Engines. Instead of compiling just what is needed in, it compiles in a base set of commonly used features. It then adds additional features as plugins.
Why? Well, this has been a long struggle and challenge for the SDK. It has been floated in the past that maybe we should go to an all plugin style architecture or maybe make the SDK smarter about including just what is needed.
The problem is, this is a complex challenge and makes the entire thing harder to maintain and keep stable. As well, I think that the various engineers tasked with addressing this found that it simply didn’t make sense. Many of the features that are included do get used eventually, just not in ‘simple’ projects.
Please bear in mind, the APK does start off with what seems like a large initial ‘empty project’ size. However, 99% of the size increases after that will be driven by:
- image files,
- sound files,
- and other large assets.
The actual game code won’t increase the size much.
So, assume you’ve got a base of ~12MB for the executable part + some other amount for assets and plan accordingly.
I should say too, 12MB is not that large, and people care less about the size of the game and more about whether it is fun:
- (52MB; > 1 MM Downloads)) https://play.google.com/store/apps/details?id=com.ketchapp.play2048
- (45MB; > 10 MM Downloads)) https://play.google.com/store/apps/details?id=com.ketchapp.mrgun
- (28MB; > 10 MM Downloads) https://play.google.com/store/apps/details?id=com.ketchapp.ballz
- (54MB; > 10 MM Downloads) https://play.google.com/store/apps/details?id=com.noodlecake.altosadventure
- (33MB; > 5 MM Downloads)) https://play.google.com/store/apps/details?id=com.freegame.solitaire.basic2
- (41MB + downloaded assets later; > 500 K Downloads) https://play.google.com/store/apps/details?id=link.merge.puzzle.onnect.number
Corona/Solar 2D Games:
Thank you for such a detailed answer. I’ll think about it.
Is that Rider made with Solar 2D (Corona SDK)?