Reduce SDK Size

The Anyline SDK ships trained models for all supported use cases. If your app only needs some of them, exclude the others from your build to reduce the installable app size.

Add the following section to your app-level build file:

  • Groovy

  • Kotlin

build.gradle
android {
    androidResources {
        // Enter any modules into "used_modules" you would like to keep and use
        def used_modules = [
                "module_energy",
                "module_id",
                "module_barcode"
        ]

        // Below is the full list of modules
        def all_modules = [
                "module_anyline_ocr",
                "module_barcode",
                "module_document",
                "module_energy",
                "module_id",
                "module_license_plate",
                "module_tire"
        ]

        // All used modules are kept, the rest are discarded (to shrink your app)
        ignoreAssetsPattern = (all_modules - used_modules).join(":")
    }
}
build.gradle.kts
android {
    androidResources {
        // Enter any modules into "usedModules" you would like to keep and use
        val usedModules = listOf(
            "module_energy",
            "module_id",
            "module_barcode"
        )

        // Below is the full list of modules
        val allModules = listOf(
            "module_anyline_ocr",
            "module_barcode",
            "module_document",
            "module_energy",
            "module_id",
            "module_license_plate",
            "module_tire"
        )

        // All used modules are kept, the rest are discarded (to shrink your app)
        ignoreAssetsPattern = (allModules - usedModules).joinToString(":")
    }
}

The androidResources block requires Android Gradle Plugin 7.0 or later. Earlier versions of this page placed ignoreAssetsPattern in an aaptOptions block inside packagingOptions. Android Gradle Plugin 9 deprecates both blocks, and Android Gradle Plugin 10 removes them. If your build file still uses them, replace them with the androidResources block above.

Then adjust the required modules in the list of used modules. These are the modules you need for each technical capability:

Technical Capability Module

VIN

module_anyline_ocr

Container

module_anyline_ocr

OCR

module_anyline_ocr

Barcode

module_barcode

Document

module_document

Meter

module_energy

Universal ID

module_id

MRZ

module_id

Japanese Landing Permission

module_id

Vehicle Registration Certificate

module_id

License Plate

module_license_plate

TIN

module_tire

Tire Size

module_tire

Commercial Tire ID

module_tire

If the app size remains unchanged after rebuilding, try uninstalling the .apk first.