I would first have you check the actual difference between a Debug
configuration vs. a signed Release
configuration in terms of "Startup Performance".
https://developer.xamarin.com/guides/android/advanced_topics/application_package_sizes/#Release_Packages
Sadly a Debug
configuration has a bit of items that are required to be in place in order to debug. This is also known as the Shared Runtime
and Shared Platform
. This is ~10MB to copy over on first run.
https://developer.xamarin.com/guides/android/advanced_topics/application_package_sizes/#Debug_Packages
Copying these core components is only done once as it takes quite a bit of time, but allows any subsequent applications running in debug mode to utilize them. Finally, we copy the actual application, which is small and quick:
So that might be one factor. But let's talk about some of the other options while we're here:
You can also use Fast Assembly Deployment
which will install the assemblies directly on the device only once and then it will copy files that have been modified since the previous deployment.
https://developer.xamarin.com/guides/android/advanced_topics/application_package_sizes/#Fast_Assembly_Deployment
Note: These two settings are "on" by default via the following MSBuild Properties: <AndroidUseSharedRuntime>true</AndroidUseSharedRuntime>
and <EmbedAssembliesIntoApk>False</EmbedAssembliesIntoApk>
Next you can use AOT
(Note: Is experimental at the time of writing):
The AOT Compilation option (on the Packaging Properties page) enables Ahead-of-Time (AOT) compilation of assemblies. When this option is enabled, Just In Time (JIT) startup overhead is minimized by precompiling assemblies before runtime. The resulting native code is included in the APK along with the uncompiled assemblies. This results in shorter application startup time, but at the expense of slightly larger APK sizes.
The AOT Compilation option requires an Enterprise license or higher. AOT compilation is available only when the project is configured for Release mode, and it is disabled by default. For more information about AOT Compilation, see AOT.
https://developer.xamarin.com/guides/android/deployment,_testing,_and_metrics/publishing_an_application/part_1_-_preparing_an_application_for_release/#AOT_Compilation
Finally you can enable the LLVM Optimization Compiler
(Note: Is experimental at the time of writing):
When the AOT Compilation option is enabled (on the Packaging Properties page), you can choose to enable the LLVM Optimizing Compiler for converting AOT-compiled assemblies into native code. The LLVM compiler creates smaller and faster compiled code, but at the expense of slower build times. The LLVM compiler is disabled by default.
Note that the LLVM Optimizing Compiler option requires a Business license or higher and is available only when AOT Compilation is enabled.
https://developer.xamarin.com/guides/android/deployment,_testing,_and_metrics/publishing_an_application/part_1_-_preparing_an_application_for_release/#LLVM_Optimizing_Compiler
Please keep this note in mind when using both AOT
and LLVM
:
NOTE: AOT is currently an experimental feature. It is not recommended for production use. AOT and LLVM was available in Xamarin.Android 5.1, but it is no longer available in later Xamarin.Android versions. For more information, please see the release notes.
Other items that can be related, but I won't go into detail based on your "File -> New Project" assumptions:
- Doing too much work before the application exits
OnCreate()
- Not shrinking your
.apk
as much as you possibly can for a fast load time