Reduce SDK Size

With the Anyline SDK integrated into your app, it is still possible to cut down on the total installable app size by identifying your Anyline use case, and using this to further optimize the app bundle delivered to users. An Anyline SDK bundle comes trained models for all supported use cases, a number of which your application may not require, and hence could be excluded from your build process.

These are the modules you will need for each technical capability:

Technical capability Module

VIN

module_anyline_ocr

Container

module_anyline_ocr

OCR

module_anyline_ocr

Barcode

module_barcode

Meter

module_energy

MRZ

module_id

Universal ID

module_id

Japanese Landing Permission

module_id

License Plate

module_license_plate

TIN

module_tire

Commercial Tire ID

module_tire

Tire Size

module_tire

By including a run script to the build phase of your application target such as the following, you can deliver a much-reduced overall app bundle size for your users. Depending on the use case you are targeting, the savings may be significant.

Run script to remove unneeded assets in the SDK
# --Available Modules--
DIR_DOCUMENT="module_document"
DIR_OCR="module_anyline_ocr"
DIR_BARCODE="module_barcode"
DIR_ENERGY="module_energy"
DIR_ID="module_id"
DIR_LICENSE_PLATE="module_license_plate"
DIR_TIRE="module_tire"

# Identify any of the SDK modules from the list above that the app requires
# eg "${DIR_ID} ${DIR_ENERGY}" and set the MODULES_TO_KEEP_ARRAY accordingly
MODULES_TO_KEEP_ARRAY=(${REPLACE} ${ME})
echo "Modules to include: ${MODULES_TO_KEEP_ARRAY[@]}"

FILENAME="AnylineResources.bundle"
MODULES_DIR_PATH=$(find "${CODESIGNING_FOLDER_PATH}" -iname ${FILENAME})

MODULES_ARRAY=(${DIR_OCR} ${DIR_BARCODE} ${DIR_DOCUMENT} ${DIR_ENERGY} ${DIR_ID} ${DIR_LICENSE_PLATE} ${DIR_TIRE})

if ((${#MODULES_TO_KEEP_ARRAY[@]})); then
    for module in "${MODULES_ARRAY[@]}"; do
        if [[ ! " ${MODULES_TO_KEEP_ARRAY[*]} " =~ " ${module} " ]]; then
            echo "Removing module ${module}"
            rm -rf "${MODULES_DIR_PATH}/${module}"
        fi
    done
fi

Please define the MODULES_TO_KEEP_ARRAY variable accordingly. For example, if you know that your application will only make use of the license plate and barcode plugins, put down: MODULES_TO_KEEP_ARRAY=(${DIR_BARCODE} ${DIR_LICENSE_PLATE}).

See below for an example of how it looks in practice:

reduce sdk runscript
Figure 1. Removing assets excluding tire
Please make sure that "For install builds only" is checked.