Need help to reduce size of cocos2d library in APK

My app is simple and the total size of resource files is less than 1MB.
Comparing the size with competitors, the file size should be around 0~2 MB. Any file size larger than 5MB will discourage users to download it.

However, it was found that the signed APK size is large due to cocos2d library (3.2 final). Is there any standard way to reduce the size or remove unused codes in the library?

I have checked the following post. But this was created 3 years ago and not sure if it is still valid. Thanks.

1 Like

Hi,

I have the same problem, any update about this ?

My apk file changed to 3MB last time so I think it is somehow acceptable.

If you are using old cocos2d-x version (before 3.2 final), you should checkout Android.mk and Application.mk in 3.2 final. There are changes in the files that helps reduce package size.
For instance,
Android.mk - “LOCAL_STATIC_LIBRARIES” instead of “LOCAL_WHOLE_STATIC_LIBRARIES”
Application.mk - “APP_OPTIM := release” for deployment

If you create the APK in release mode, any unused codes will be stripped. You can also check the file “cocos/base/ccConfig.h” to disable physics if you don’t want it.

2 Likes