This article introduces approaches for limiting the size of your APK files for your Android deployments.
The Runtime SDK for Android makes use of a native library written in C++. The library provides very fast map rendering and processing capabilities which have consistent behavior on all supported ArcGIS Runtime platforms. Your map in an app written for an iPhone using the iOS SDK will look the same as it does on the various Android architectures.
Android supports many instruction set architectures, and the APK needs a compiled version of the native Runtime library (included as an .so file) for each architecture. Consequently, the final APK size can get quite large, especially if you are using multiple native libraries. The Google Play Store, however, limits your APK to 100MB.
For a larger application, you might need to reduce the size of your deployment. You have two options: ABI filters and SDK splits.
ABI (Application Binary Interface) filters determine which architectures to allow in an APK deployment. For example, x86 architectures, typically used for emulator environments, are generally not included in release builds.
ABI filters are applied in your Gradle build script (Module:app). The abifilters property in ndk specifies which ABI(s) to include in a build type. The following example applies an ABI filter to the release build, allowing only architectures supported by the armeabi-v7a ABI. While indispensable for debugging on an emulator, the x86 libraries do not belong in your deployed APK.
Without an ABI filter, your APK will include all available architectures, with .so files for each. In the image below, the APK is 43.8 MB.
After applying the filter, APK size reduces from 43.8MB to 24MB.
Additional information about ABI management in your application can be found at ABI Management on developer.android.com.
If your application supports many architectures, you can further reduce APK size by using APK splits, whereby each APK includes only one architecture.
In release 100.5, ArcGIS Runtime for Android will support x64 architectures, adding more .so files to a single APK deployment. If you are deploying to the Google Play Store, consider APK splits to reduce the download size of your app. In areas with slow mobile networks or high data costs, smaller download size can make a big difference. For more information go to Build multiple APKs on developer.android.com.