-
-
Notifications
You must be signed in to change notification settings - Fork 19.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize APK size for Android #18253
Comments
Thanks for sharing your experience :) |
@Shin-NiL Thank you for your amazing modules! :) |
I was able to improve it a little bit more using Proguard. I'm still testing it to be sure that everything is working but it seems to work. Now libgodot_android.so is 7.2MB uncompressed and 2.8MB compressed. :) |
Hi @megasoft, could we get a link to your appbrain module. I am about to do the same thing. Felt if you've already done it, no need to reinvent the wheel. However, if you can't provide it, I will just do it with their new mediation platform and stick it in GitHub for others. Cheers. |
Hi,I attached the module but I think you need to tweak it to make it work. It was working on Godot 2.1.5. :)
Cheers
Il venerdì 31 agosto 2018, 10:34:00 CEST, Benjamin Yakubu <notifications@github.com> ha scritto:
Hi @megasoft, could we get a link to your appbrain module. I am about to do the same thing. Felt if you've already done it, no need to reinvent the wheel.
However, if you can't provide it, I will just do it with their new mediation platform and stick it in GitHub for others. Cheers.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Hi, Cheers |
Thanks @megasoft. Cheers |
wow, just did this my executable went from 40mb to 20... thank you!! |
This could go on the documentation section about optimizations for size |
I get this error at image. https://imgur.com/a/mPIP6lM How Fix that |
It looks like vorbis module is required in your case. Remove the builtin_libvorbis=no and module_vorbis_enabled=no from the command line. :) |
Ok. i'll. try |
this should pinned or put in the documentation. Thank you |
@mani144 I just opened a pull request to document APK architecture optimization (see above), which is an important step many people forget 🙂 As for other optimizations, I wonder if they could be integrated directly in Godot somehow. ProGuard in particular could be integrated into the current Gradle setup, including the one that's used for the custom Android build template. |
we could suggest scons module details and what is optional for android and ios exporting |
hi @megasoft78 , can you pleases share with us your commented register_scene_types file? |
I attached my register_scene_types.cpp. I hope it help. ;) |
you are amazing :) thank you very much for this fastest answer what I ever
have got and for sharing your approach in compiling godot. It was hell for
me last 3 days and your article at github was like light in this darkness
:D now i have 16MB apk and maybe get smaller after succesfull change of
register types file.
thank you very much ;)
pi 15. 11. 2019 o 11:24 megasoft78 <notifications@github.com> napísal(a):
… I attached my register_scene_types.cpp.
I hope it help. ;)
register_scene_types.zip
<https://github.com/godotengine/godot/files/3850999/register_scene_types.zip>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#18253?email_source=notifications&email_token=AI3PCLGRDYVUXU7X6TDFXIDQTZ2HDA5CNFSM4E3BOXCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEFAASY#issuecomment-554303563>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AI3PCLAX5RTLWQMRCGKGASDQTZ2HDANCNFSM4E3BOXCA>
.
|
Don't worry! I know how you feel. Keep going! You'll get there! ;) |
I am noob in godot can say where to run that command |
@Vignesh1-art Are you talking about |
Thank you very much for sharing. It helped a lot. But during building with scons, i'v got this error:
I'm using a custom.py like below instead of passing all the argument in cmd
Any one face the same problem like me. My Specs: Thank you very much |
"Latest" is not a version. Also, make sure to build from a stable tag like The export template versions must match the editor version exactly. |
@Calinou , Thanks, i forgot about that. I'll build from 3.3.2-stable 🐱 |
The documentation was improved and AAB support was added to automatically exclude unused architectures (on Google Play's end), closing. |
When I use the plugins (Use Custom Build), the custom template is not used. I replaced the default template's .aar files with newly generated .aar files. Apk size is reduced now but just by 2-3 mb. If I do not use custom build, the generated apk size would have been much smaller. Do you have any idea how we can make custom build and custom templates work together? |
@maihomahesh You should use the The current workflow to do that is a bit awkward as of Godot 3.4, if you have a custom build which is not named Otherwise, you can unzip it manually in |
@akien-mga Thank you for a quick response. |
Hi,
I've been playing a bit with compiling Godot to optimize apk size for simple game like mine:
https://play.google.com/store/apps/details?id=it.megasoft78.fallingword
My current result is 6.5 MB for the complete game apk and 5.3 MB for the template.
This template include the following modules:
Here's are the optimizations I did:
in platform/android/detect.py changed -O2 to -Os and add -s:
I run the compilation with the following options:
scons -j6 platform=android --config=force target=release tools=no deprecated=no minizip=no xml=no builtin_glew=no builtin_libmpcdec=no disable_3d=yes disable_advanced_gui=yes builtin_openssl=no module_openssl_enabled=no builtin_libogg=no builtin_libtheora=no builtin_libvorbis=no builtin_opus=no builtin_speex=no builtin_squish=no builtin_zlib=no module_chibi_enabled=no module_cscript_enabled=no module_dds_enabled=no module_etc1_enabled=no module_gridmap_enabled=no module_ik_enabled=no module_jpg_enabled=no module_mpc_enabled=no module_ogg_enabled=no module_opus_enabled=no module_pbm_enabled=no module_pvr_enabled=no module_speex_enabled=no module_squish_enabled=no module_theora_enabled=no module_vorbis_enabled=no
I disabled all the modules I don't need.
I also comment out in scene/register_scene_types.cpp all the calls to ObjectTypeDB::register_type that I don't need in my game.
My template is arm only because most of the x86 devices on Android support arm emulation and anyway are a very small percentage.
In my game I also used under Project Export Settings on tab Images WebP and on tab Samples IMA-ADPCM.
I was looking to remove physics because I don't use it but it wasn't easy and I give up. :)
The final libgodot_android.so is 8.5MB uncompressed and 3.2Mb compressed in apk.
My assets are 2.5MB uncompressed and 1.1MB compressed in apk.
The classes.dex is 5MB uncompressed and 1.9MB compressed in apk (most of the size is Google Play Services for Admob)
I'm quite happy with the final result and I hope this informations can be useful to other people. :)
If you have any idea to improve even futher just let me know.
The text was updated successfully, but these errors were encountered: