Reduce APK size
The code on this page works with either the default UI or the custom UI.
Since our SDK contains NDK code, it must be built individually for all CPU architectures to satisfy each ABI type. As a result, adding the SDK to your project may have the unintended consequence of drastically increasing your APK size. Here are a couple of steps you can take to mitigate a significant portion of this increase.
Applying ABI filters
If you know that you will not need to support certain CPU types,
filter them out in your app's build.gradle file. To do so, add
this block within defaultConfig.
ndk {
abiFilters 'x86', 'x86_64' // Do not build for x86 & x86_64 CPUs
}
Doing this for all CPU architectures you do not wish to support can greatly reduce the size of the SDK's files.
Do not extract native libraries
Another step you can take to reduce the size of the SDK is to set the
following attribute in your AndroidManifest.xml.
<application
extractNativeLibs='false'
See Avoid extracting native libraries in the Android Developers documentation for details.
Additional resources
See Reduce your app size in the Android Developers documentation for more tips.