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.
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?
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).
- 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.
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 )
is fix this issue on MOE 2.x ?
MOE 2.0 will have a feature to generate precise ProGuard rules at runtime.
Wish you the best.