Android size of libcocos2dcpp.so is 4.9 MB

Hello,

This size of libcocos2dcpp.so on android is 4.9 MB increasing the size of my game.

I tried using APP_OPTIM := release from http://www.cocos2d-x.org/forums/6/topics/1615, but did not get any reduction.

How can i reduce the size of APK apart from optimizing graphics and sound?

It is a physics based game.
I am using cocos2d-x version 2.21.

1 Like

What’s the problem with 5MB ? You can still compile for 2 other architectures and be at 15MB, which is way under the 50MB soft cap of Google Play (for example).

Do you have any hard requirement on size ?

Perhaps you could check this article : http://blog.algolia.com/android-ndk-how-to-reduce-libs-size/ but frankly, I don’t see the point of reducing the game size any further.

Thanks for the reply Fradow,

I am just trying optimize the size of the game, no hard requirement on size.

I will explore the link given by you.

Regards

I advise you against trying to optimize the binary size, really, it’s a waste of time for most normal uses.

If you want to optimize the size of your apk, the simplest solution is generally to compress assets.

You’d be surprised at the difference 5mb makes to downloads. I remember seeing a really interesting Popcap presentation; they spent a buttload of resources to shave 7mb off of the Plants vs Zombies download and saw a significant increase in downloads for their effort.

My .so library’s at 6.5mb uncompressed, 2.5mb compressed (cocos2d-x 3.1.1). I’m keeping it on armeabi only for now as my game is not computationally complex, runs perfectly fine on all devices I’ve tested on (including old 2.3.3 bricks) and my total APK size is just over 8mb. I’d still like to see if any further optimisations can be done though!

I’d be interested to know how Popcap can correlate the reduced size with that triggering the downloads versus some other factor that made people download.

I wouldn’t not download something due to size. I might choose to download it over wifi vs cellular data and/or I might prefer to download it on my computer and then sync it if it is really big.

It wouldn’t really affect me either. But it certainly affects some people in some parts of the world, and that’s good enough reason for me to want to keep size to a minimum.

ok… sounds cool… :smile:

if you find something, share with us here.
provided that compression doesn’t create any additional issues

or else it would be of no use.

I would like to flame the topic raised here about downloading based on file size.

However, the file size may effect on low memory devices, suppose if i have to download a game that is very large and my memory is low
so it wont install at the first place. (talking about the devices having very low internal memory)

so in that case it might be a reason for optimization of size
otherwise… for file sizes @jugnoyasir and @duckinferno mentioned doesn’t need it.
still if it is possible without sacrificing anything… !!

Please let us avail the benefit of it. :smile:

Happy Coding

True! One of my test devices had literally 40mb to spare for non-stock apps. I got around it by telling it to install on the SD card if needed (android:installLocation="auto" in the manifest) but it really highlights the importance of optimisation; some devices and data plans rely on compact apps.

I’ve found a few resources…


This guy got a bad app review because his app took up over 20mb of space. He uses a tool to take down the size of his library (arm-eabi-strip).


A great thread from this forum that goes into detail about cutting down the APK size, from a cocos2d-x perspective.


A discussion about ProGuard and how to get it working in cocos2d-x. Aside from obfuscation, ProGuard performs a lot of optimisation and can significantly cut down the size of the .dex file.

I haven’t really done anything yet, but I’ll be sure to report back.

Hi @duckinferno

i should really say that you made some efforts to bring these important topics to the limelight. :smile:

I am sorry to say that i do not get the 3rd link.
but the first link was useful and more is the 2nd link that you’ve posted here.

also the topics brought up in the 2nd link is quite useful but i believe they have already been implemented by the developers as they were posted in 2011.
but i am also keen to know more about this.

@slackmoehrle did you see these links… ??
as i am not aware of these event, could you tell us a summary of the links
what i mean to say is… whether the topics raised on the 2nd link are integrated into cocos2dx for optimization… !!
and something about the arm-eabi-strip --strip-debug --strip-unneeded libxxx.so

whats your call… ??

I think you’re right, all of my efforts have done little to shrink the size of my library – it seems like the optimisations are already in place.