Reduce your APK size

This article introduces approaches for limiting the size of your APK files for your Android deployments.

ArcGIS Maps SDK for Kotlin 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 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 ArcGIS Maps API for Kotlin 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 applications, there are two options to reduce the size of your deployment: ABI filters and SDK splits.

ABI Filters

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 ABI filters to the release build, allowing only architectures supported by the armeabi-v7a and arm64-v8a ABIs. 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 76MB.

APK without an ABI filter

After applying the filter, APK size reduces from 76MB to 51MB.

APK with an ABI filter

Additional information about ABI management in your application can be found at ABI Management on developer.android.com.

APK Splits

If your application supports many architectures, you can further reduce APK size by using APK splits, whereby each APK includes only one architecture.

ArcGIS Maps SDK for Kotlin, release 100.5 and later, supports 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.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.