Reduce SDKs size

This page presents some elements that will reduce the size of the SDKs.

Publication form

Currently, Android provides two formats for publishing applications in the Play Store: APK and Android App Bundle. If you publish using AAB, the size of the SDK will be smaller because Dynamic Delivery technology will make available to your end user only the code directed to the device settings.

Important: if you use DocumentDetector, it is of utmost importance to publish your app via AAB, because the biggest weight of the SDK is caused by the library responsible for document recognition, where each ABI configuration is about 1 MB.

Transitive dependencies

Our SDKs use some internal dependencies, such as CameraX. If your app already uses one of our transitive dependencies, the SDK will not need to download again, reducing the final size.

Optimizing SDK size (only for DocumentDetector)

If you want to reduce the DocumentDetector SDK size, you can reduce the number of architectures that TensorFlow will be compiled on, but only do this if you are sure that your audience only uses devices with the chosen architectures, otherwise you may get errors when opening the SDK. To do this, add the following setting to your app-level build.gradle:

android {
    defaultConfig {
        ndk {
            abiFilters 'armeabi-v7a', 'arm64-v8a'

According to TensorFlow documentation, this setting covers most modern devices.

Last updated


2023 © Caf. - All rights reserved