# Reduce application size

> Measure the signed release, keep one native binary, and move optional authored packages out of the initial mobile download.

> For AI agents: the complete documentation index is at https://nosmai.com/llms/effects.txt

Product: Nosmai Effects
Group: guide
Source: https://nosmai.com/docs/effects/guides/performance/reduce-app-size/

## Prerequisites

- A signed production AAB or App Store archive
- The current native checksums and dependency lockfiles
- An inventory of bundled `.nosmai`, preview, image, video, and model assets

## Measure the delivered application

Do not use the AAR, framework ZIP, Flutter archive, or npm tarball as the final
store-size estimate. Measure Play Console device delivery and App Store archive
thinning for the signed application. Record baseline download and installed
size before changing dependencies.

## Keep one native SDK

- Replace old AARs instead of accumulating versioned filenames in `app/libs`.
- Use either CocoaPods or manual framework embedding on iOS, never both.
- Inspect Flutter and React Native host projects for an extra manually linked
  native binary.
- Keep only the supported ARM64 target required by the release policy.

## Move optional effects on demand

Bundle only the packages required for the first experience. Deliver optional
effects through Cloud Filters and rely on SDK-managed local storage after a
verified download. The operating system can reclaim cache storage, so retain
the cloud identifier and support redownload rather than assuming the path is
permanent.

Compress and resize host-owned preview images, videos, and thumbnails according
to their actual display size. Do not modify protected `.nosmai` package
contents.

## Verify the optimized build

1. Compare signed store-delivery size with the baseline.
2. Install on a clean physical device.
3. Open the first camera experience without downloading optional content.
4. Download, apply, reuse, remove, and redownload a Cloud Filter.
5. Test offline behavior for already cached and evicted content.

## Common errors

| Symptom | Cause | Fix |
| --- | --- | --- |
| Size did not fall after deleting an AAR | Another wrapper or build cache still packages the binary | Inspect the final archive and dependency graph, then clean and rebuild |
| Cloud Filter works once but later path is missing | The OS reclaimed cache storage | Store the identifier and download again through the SDK |
| iOS reports duplicate symbols | Pod and manual framework are both embedded | Choose one iOS distribution path |

## Next steps

- [Review artifact sizes](/docs/effects/limits-and-performance/#published-artifact-sizes)
- [Download a Cloud Filter](/docs/effects/guides/filters/download-a-cloud-filter/ios/)
- [Review release compatibility](/docs/effects/releases-and-compatibility/)

## References

- [Platform support](/docs/effects/platform-support/)
- [Cloud Filters](/docs/effects/concepts/cloud-filters/)
