Skip to content

Don't compile in dependencies that aren't used by given tool #178

Description

@dupontgu

Noticed this while trimming my own tool and it seems worth flagging, since it
affects everything built on the SDK.

:sdk:ui includes LightQrCodeScanner, which pulls in ML Kit's barcode model.
libbarhopper_v3.so is 19.3MB of a 29MB release APK — about two thirds of the
download — and it ships for four ABIs on a phone that's arm64 only.

My tool doesn't scan anything, so I excluded it:

implementation(project(":sdk:client")) {
    exclude(group = "com.google.mlkit")
    exclude(group = "com.google.android.gms", module = "play-services-mlkit-barcode-scanning")
}

That took the APK from 29MB to 8.5MB and native libs from 19.51MB to 233KB. I
went through every screen on a debug build and again on a minified release
build — no missing classes, no crashes.

Two questions. Is excluding it reasonable, or am I working around something I
shouldn't be? And would it make sense for the scanner to be opt-in, so tools
that don't scan don't carry the model?

Originally posted by @jedbridges in #177

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions