Model delivery

Android Model Asset Compression and Packaging Test

Record whether the model is bundled, compressed, extracted, streamed, memory-mapped, or downloaded before choosing packaging rules.

Review status: Fact and editorial QA complete; owner review pending · 2026-10-04 · Fact IDs: COVE-MODEL-02, MEMORY-02

Direct answer

The noCompress setting is a packaging choice tied to how the app reads a bundled file; it is not a general performance or compatibility switch. Android’s AssetManager documentation says openFd returns a file descriptor for an uncompressed asset and throws if the asset is compressed. The Gradle AndroidResources noCompress option stores selected extensions uncompressed in the APK. That supports a specific engineering rule: choose compression policy only after deciding whether the runtime needs a file descriptor, a streaming InputStream, an extracted copy, or a downloaded file. Do not add a broad noCompress rule for every model-like extension without checking package size, install behavior, and access API. The Cove repository’s current ModelDownloader downloads artifacts to configured storage; the model facts and code do not establish that Cove currently bundles a model inside an APK. This guide therefore applies to Android projects that intentionally package an artifact as an asset, and its method must not be reported as Cove’s current packaging behavior. A model file placed in assets may still be compressed by Android packaging unless configuration changes it. Conversely, uncompressed packaging does not make an asset memory-mappable through every API and does not certify the model format or runtime can read it. Start with access requirements. AssetManager.open provides an InputStream suitable for sequential access; AssetManager.openFd supports an uncompressed asset and returns a descriptor that may support file-based access. Some runtime APIs require a filesystem path or a file descriptor; others accept a stream or copied file. Verify the selected runtime’s documented contract. If extraction is required, define the destination, atomic install behavior, free-space planning, digest check, and cleanup. If an asset is streamed directly, test whether the parser supports seeking and large reads. Compression can trade package size against decompression and access behavior, but do not invent a speed or RAM benefit. Validate the packaged and installed artifacts separately. Inspect the generated APK/AAB or bundle contents and compare the model asset’s entry name, compression method, byte length, and hash where available. Then install the exact build and exercise the actual read path on a controlled device. A debug APK can differ from a release bundle or split delivery; check each declared distribution artifact rather than assuming the same bytes. If an app bundle generates splits, verify the asset is present in the install set actually delivered to the target configuration. Do not use app-store distribution claims unless the build and release evidence exist. NoCompress affects every matching extension included by the configured rule. Adding an empty extension can disable compression broadly, which can change packaging for unrelated assets; avoid a blanket setting as a shortcut. Prefer the narrowest extension or packaging rule required by the access method, then inspect the built archive to confirm the rule did what was intended. Build-system DSLs evolve, so use the Android Gradle Plugin version documented by the project and verify the exact property syntax. A configuration declaration is not evidence of actual APK contents until the packaged artifact is inspected. Test failure modes: an asset remains compressed while code calls openFd; a release package differs from debug; a compressed file is extracted into storage without enough room; a copy is interrupted; an update leaves a stale extracted file; a same-named asset changes revision; or the runtime rejects the bytes. Keep model artifact identity and app package identity separate. If packaging fails or access is unavailable, expose a setup error instead of claiming the model is installed. Preserve user records; deleting an app asset cache must not delete conversations or imported data. ### Procedure 1. Choose the intended read path: stream, uncompressed descriptor, extracted filesystem file, or post-install download. Read the runtime and AssetManager contracts before configuring packaging. 2. Set the narrowest noCompress rule only if the chosen API requires uncompressed bytes. Record the AGP version and avoid a blanket rule that changes unrelated assets. 3. Inspect the built APK/AAB and any generated splits. Record compression method, entry path, exact length, hash if verified, and whether the delivered install set contains the asset. 4. Install the exact release artifact and exercise the read/extraction path, interruption, low-space, update, and runtime-load cases on a controlled test device. 5. Keep package presence, file integrity, runtime load, and task readiness distinct in UI and diagnostics; preserve user content if an asset or extraction must be repaired. ### Acceptance criteria - The compression rule is justified by a documented access API, not by a model filename convention. - Built package contents are inspected and match the expected asset identity and delivery set. - Debug and release/package-split access paths are tested separately where they differ. - Failure or missing asset produces an honest recovery state and cannot erase user records or imply model readiness. ### Comparison | Packaging/access path | Useful property | Boundary | |---|---|---| | Compressed asset with stream access | Can reduce packaged bytes and stream through AssetManager | May not provide the uncompressed file descriptor some APIs require | | Uncompressed asset with openFd | Exposes a descriptor for an uncompressed packaged asset | Changes package size and still does not prove runtime compatibility | | Extracted or downloaded file | Provides a filesystem path that some runtimes require | Needs space, integrity, atomic replacement, and cleanup policy | ### FAQ **Should every model extension be added to noCompress?** No. The setting should follow the actual access API. A stream-based parser may not need it, while openFd requires uncompressed assets. Inspect the exact build output before keeping a rule. **Does noCompress make model loading faster?** Do not assume that. It changes packaging compression behavior; runtime load, memory use, and task speed depend on the selected implementation and require separate measurements. **Does an uncompressed asset become a normal file path?** Not automatically. AssetManager can provide a descriptor for an uncompressed asset, but some APIs require extraction to app storage. Follow the runtime’s documented input contract. **Does the existence of a bundled asset mean the model is ready?** No. Verify the delivered package, file identity, integrity, runtime load, and required task. Packaging alone does not establish support or offline readiness.

A bundled model opens in debug but fails through the release access path

An Android team experiments with packaging a large model in assets. Debug code reads a file successfully, but the production runtime expects a descriptor or seekable path. The team needs to test compression, extraction, and actual release package contents without claiming that all apps should bundle models.

Decision

Choose packaging rules from the runtime’s access contract, inspect the exact built artifact, then test release installation and runtime loading separately.

Expected outcome

The team can explain whether the asset is compressed, streamed, extracted, or downloaded and can reject a mismatched package without inferring performance results.

Evidence to collect

The claim becomes reviewable only when the following evidence is attached to the same artifact and test run:

  • Artifact format and exact length
  • Package and installed-storage inventory
  • Install, access, load, and update results

A completed byte stream is not enough. Final placement, integrity, runtime load, and recovery must also pass.

Implementation workflow

  1. Read the actual runtime input contract. Determine whether the model runtime accepts a stream, an uncompressed asset descriptor, or a filesystem path. Do not set noCompress until the selected API requires that representation.
  2. Constrain the packaging rule. Use the narrowest extension or resource rule compatible with the access path. Record AGP version and avoid disabling compression for all assets when only one artifact needs it.
  3. Inspect built package bytes. Open the actual APK/AAB or install splits and record the asset path, compression method, exact length, and digest if verified. Confirm the delivered install set contains the required object.
  4. Test installed release access. Install the release artifact and exercise descriptor, stream, or extraction code on a controlled environment. Test interruption, low storage, update, and load failure.
  5. Separate packaging from readiness. Report asset present, integrity checked, runtime loaded, and task ready as distinct states; preserve user data if an asset needs repair or re-download.

Keep each transition observable. A failure should identify the stage, artifact, runtime, and recovery action without logging private user content.

Acceptance criteria

  • The chosen noCompress rule is tied to a documented reader requirement.
  • The built package and delivered split set contain the expected asset identity and compression behavior.
  • The exact installed release path is tested separately from debug packaging.
  • Missing or unreadable assets do not produce a ready state or delete user-created records.

Decision table

DimensionChoice or evidenceHow to interpret it
Compressed asset streamSequential AssetManager inputMay suit streaming readers but not APIs requiring openFd.
Uncompressed asset descriptoropenFd-based accessProvides a descriptor for uncompressed data, not universal runtime support.
Extracted/downloaded fileFilesystem pathRequires storage planning, verification, atomic write, and cleanup.

Failure patterns to prevent

  • Adding every extension to noCompress
  • Assuming bundled assets are memory-mappable

Also prevent silent fallback, unpinned artifacts, missing cancellation, and conclusions that combine unlike configurations. Store unsuccessful runs alongside successful ones.

Minimum reproducibility record

LayerRecord
DeviceManufacturer, model, chipset, RAM class, operating-system build
SoftwareApplication version and git commit
ModelFamily, variant, revision, format, file length, hash, quantization
RuntimeName, revision, requested backend, observed backend evidence
WorkloadFixture revision, input hash, prompt hash, output policy
OutcomeCompleted, failed, cancelled, fallback, and privacy-safe diagnostics

Release checklist

  • ☐ The primary query is answered without an unsupported number.
  • ☐ Every artifact and runtime is pinned.
  • ☐ The representative task and failure policy are explicit.
  • ☐ Lifecycle, cancellation, cleanup, and fallback are tested.
  • ☐ User-content and network boundaries are documented.
  • ☐ Result wording applies only to the recorded configuration.
  • ☐ The page links to raw method or evidence when results are added.

Sources and related evidence

Chinese deployment and troubleshooting content is organized in the .奇连 AI 端侧专题.

Frequently asked questions

Should every model extension be marked noCompress?

No. Choose based on the exact reader API. A stream reader may not require it, while openFd requires an uncompressed asset; inspect the built output before adopting the rule.

Does noCompress make inference faster?

That cannot be inferred from the packaging flag. Runtime load, memory, and task speed depend on implementation and need separate measurements for the exact artifact and device.

Does an uncompressed asset have a normal filesystem path?

Not automatically. AssetManager can open a descriptor for an uncompressed asset, but some runtime APIs require extraction into app-owned storage. Follow the runtime contract.

Is a bundled asset automatically an offline-ready model?

No. Confirm package delivery, artifact identity, integrity, runtime initialization, and a representative task. Asset inclusion alone does not establish readiness or compatibility.