When i creat a simple iOS app in Multi-OS Engine the app size is 140 MB. Is there any way to optimize the size of the app.
By default only āappā level ProGuard is applied to reduce the build time during development.
For release builds you should change this to āallā level in your build.gradle. More information in the Gradle plugin documentation
I have tried by adding proguardLevel āallā but the size of the app is 62 MB. The app is very simple Hello world app but the size is 62 MB. Is there any way to optimize the size of the app.
Whin I change the proguardLevel āallā the app is not launching. In opens with the black screen.
You need to adjust the ProGuard settings, e.g. add required classes to proguard.append.cfg.
62MB is way more than a simple hello world should be, there is probably something else at play there.
This is a win of Java technology. Hello in C takes few kb. Also it executes more then 10x times slower (and even worse) then program in C.
Thanks java.
Gergerly, do you have a sample proguard config for āallā level? E.g. in one of the demo apps. That would be a really good starting point for all of us.
Actually, the starting point is already in the SDK, there is a separate proguard-full.cfg that is used if you select the āallā option. It should work with the samples / hello world apps out of the box. If it is not, then let us know, because it is a bug.
Iāve just tried the RSSReader example with proguardLevel=all. Itās working correctly.
Unfortunately Iām also experiencing the black screen issue on iOS with no errors in logs - even after adding classes and methods that could be obfuscated to the proguard.append.cfg - as it is in the android module.
Is there any way that could tell me what classes Iām missing with full obfuscation?
As Iāve found - there is such a tool, created by @Noisyfox. It has solved my black screen issue.
Good catch, I completely forgot about this (Thanks to @Noisyfox again).
Just a small teaser: we are working on a feature for MOE 2.0, that will create accurate ProGuard rules during the appās execution. Of course this will only generate the correct results if you test your app correctly, but everybody should do that anywaysā¦
I also noticed that starter app (project set up by libGdx out of the box) was about 120 MB. After enabling āproguard allā it dropped to 80 MB.
I looked closer into .app bundle, and found the binary was about 55MB. It is fat binary with two architectures: armv7 and arm64. Hopefully, App Store download will cut it in about half. ARM64 binary is 29MB and armv6 is 22 MB. MOE framework is 26MB - numbers nicely add up.
Still, Iām curious if thereās more room for size optimization of 20+ line Java program?
Thanks!
You need to also consider that the full Java runtime and class library needs to be included with the app. ProGuard will optimize these parts as well, but there are no miracles. For example Swift has the same problem (and it will for a couple of years until ABI compatibility is reached - it was just pushed out of the Swift 4 plans), it also has a ~20 MB (I did not check the exact number) runtime that needs to be linked to the app.
The truth is, that once you move away from the āhello worldā stage and you are looking at larger apps (e.g. a game with lots of assets), the overhead will be a much lower percentage of the app. Plus, you need to factor in the increased development speed (the access to the Java ecosystem and code sharing across platforms).
I am not saying, that there is nothing to be done. There is a lot of room for improvement. For example, MOE already uses an ICU emulation layer, so we donāt need to include a custom ICU (Apple does not allow the use of the system ICU directly in apps).
Concrete examples:
- Moving to CommonCrypto from OpenSSL would reduce the size of the MOE framework.
- If we leave out the JDWP debugger from production builds, that will also make the overhead smaller.
The reality is, that all these require development effort. We (Migeran) have to first concentrate on the needs of our paying customers, and develop the features they want. If someone (or a group) comes forward and is willing to sponsor the development of these size reduction features, then it will be developed sooner.
Hi!
I had similar problem with app.
In my case was problem with resources. When i unpacked .ipa file,
i saw there is one resources folder in root folder and the same folder inside application.jar. I solve this by remove resources source set at ios-moe/build.gradle file.
Try to unpack .ipa file and figured out what is going on.
(sorry for my english )
Dear @kisg
is fix this issue on MOE 2.x ?
if not i will add it my my self from this posed by @Noisyfox
MOE 2.0 will have a feature to generate precise ProGuard rules at runtime.