Hi,
Notice that the apps size has a huge different between iOS and Android, the app size for iOS is larger than the Android about ~100 MB. Any idea to remove those redundant files/libs for iOS build? or reduce the size?
Hi,
Notice that the apps size has a huge different between iOS and Android, the app size for iOS is larger than the Android about ~100 MB. Any idea to remove those redundant files/libs for iOS build? or reduce the size?
Hi,
there is an overhead, because MOE needs to include the ART runtime and the Java class library in each app - on Android these can be shared.
By default MOE only runs ProGuard on the application code, not on the Java class library in iOS Java bindings. This is fine for development, because the build time is less. This setting results in the 100+ MB app size that you see.
For production builds, we have a configuration setting in the Gradle plugin to run ProGuard on both the app and the standard libraries:
moe {
proguardLevel 'all'
}
This setting will provide significant savings in the application size.
Best Regards,
Gergely
Hi Gergely,
Where should I add this line? I add this “proguardLevel ‘all’” in …/ios-moe/build.gradle, but there’s an error “DSL no method found”. Or we have to modify files in MOE application folder?
Dear le_mc,
You can find the exact usage of proguardLevel here.
Example:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath group: 'org.multi-os-engine', name: 'moe-gradle', version: '1.1.+'
}
}
apply plugin: 'moe'
moe {
proguardLevel 'all'
// ...
}
Hi Kristóf,
Thanks for your prompt support. no chance, still “DSL no method found” and gradle build failed. Is it I have to update my MOE to latest version 1.0.1? by the way I am using libgdx, is it the ‘moe’ is referring to libgdx project ‘ios-moe’ ?
Best Regards,
le
Hi,
yes, you will need to use MOE 1.1+ and libgdx 1.9.5-SNAPSHOT (because 1.9.5 is not yet released). Things are a bit in flux now in libgdx due to the upgrade to MOE 1.1. We will test the latest libgdx version from Github and let you know.
Best Regards,
Gergely
Hi Gergely,
Thanks. Hope to get an update from you sooner.
Best Regards,
le
Hi Gergely,
proguardLevel ‘all’ is working fine with latest MOE. However, after adding that line, it seems like assets are not loaded as the app’s showing black screen?
Also, do you have any notes for each proguardLevel details? e.g. platform / all / default ?
Best Regards,
le
Dear le_mc,
you are experiencing this because proguardLevel 'all'
is very aggressive and may trim more classes than it should. You can control ProGuard’s behavior by creating a proguard.append.cfg
file in your MOE module’s directory.
Something you may want to put in there for example is:
-keep class ios.uikit.protocol.UIApplicationDelegate { *; }
All Objective-C protocols that are being used must be kept, otherwise the next phase of the build process may not function as expected.
A complete list of ProGuard options is available here.
Hi Kristóf,
It is working fine, and the size has reduced to around 95 MB while in Android is only about 20 MB. Is it possible to further optimize?