# Install for Flutter

> Add nosmai_effects_sdk 1.0.2 to Flutter and configure its native iOS and Android dependencies on a physical ARM64 device.

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

Product: Nosmai Effects
Group: get-started
Source: https://nosmai.com/docs/effects/installation/flutter/

## Prerequisites

- Flutter 3.22 or later
- Dart 3 or later
- iOS 15 or Android API 21 as the minimum application target
- A physical arm64 iOS or `arm64-v8a` Android device
- A [Nosmai licence key](/docs/effects/license-key/) for each native app identity

## Add the Dart package

```sh
flutter pub add nosmai_effects_sdk:^1.0.2
flutter pub add permission_handler
```

The public Dart package contains the Flutter API and native bridges. It does not
contain proprietary native SDK binaries or licensed `.nosmai` assets.

## Add the Android native SDK

Download `nosmai-sdk-3.0.4.aar` and `SHA256SUMS` from the
[official Android release](https://github.com/nosmai/nosmai_effects_sdk_android/releases/tag/v3.0.4).
Verify the checksum, then copy the AAR to this exact path and name:

```text
android/app/libs/nosmai-release.aar
```

Add the app-owned runtime dependency in `android/app/build.gradle`:

```gradle
android {
  compileSdkVersion 35

  defaultConfig {
    minSdkVersion 21
    ndk {
      abiFilters 'arm64-v8a'
    }
  }

  compileOptions {
    sourceCompatibility JavaVersion.VERSION_11
    targetCompatibility JavaVersion.VERSION_11
  }
}

dependencies {
  implementation files('libs/nosmai-release.aar')
}
```

The Flutter plugin uses `compileOnly` for this dependency so the native binary
is not duplicated in the pub.dev archive. Keep exactly one app-level AAR.

Add permissions to `android/app/src/main/AndroidManifest.xml`:

```xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />

    <application
        android:label="camera_app"
        android:name="${applicationName}"
        android:icon="@mipmap/ic_launcher" />
</manifest>
```

## Configure iOS

Set the minimum deployment target in `ios/Podfile`:

```ruby
platform :ios, '15.0'
```

The Flutter pod depends on `NosmaiCameraSDK ~> 3.0.4`. Do not add a manual
framework copy when using CocoaPods.

Add permission descriptions to `ios/Runner/Info.plist`:

```xml
<key>NSCameraUsageDescription</key>
<string>This app uses the camera for real-time filters and effects.</string>
<key>NSMicrophoneUsageDescription</key>
<string>This app uses the microphone when recording video.</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>This app saves captured photos and videos to your library.</string>
```

Install pods:

```sh
cd ios
pod install --repo-update
cd ..
```

The iOS framework has no simulator slice. Run the camera integration on a
physical arm64 iPhone or iPad.

## Native size impact

The Android AAR is about 51.4 MiB before App Bundle optimization. The verified
iOS framework release ZIP is about 22.9 MiB compressed. The Dart wrapper is
small relative to the native binaries. Measure signed release builds because
store compression, app thinning, selected assets, and existing dependencies
change the final download increase.

## Verify it worked

Run static analysis:

```sh
flutter analyze
```

Then build for one physical target:

```sh
flutter build apk --debug
```

or:

```sh
flutter build ios --no-codesign
```

A successful native build confirms package linking. Continue to the
[Flutter quickstart](/docs/effects/quickstart/flutter/) to request permission,
initialize Nosmai, and render a visible effect.

## Common errors

| Error | Cause | Fix |
| --- | --- | --- |
| `Could not find :nosmai-release:` | Android AAR is missing or named differently | Put the verified artifact at `android/app/libs/nosmai-release.aar` |
| `Duplicate class com.nosmai` | More than one native AAR is linked | Remove duplicate copies and keep the app-level runtime dependency only |
| `INSTALL_FAILED_NO_MATCHING_ABIS` | Android device lacks `arm64-v8a` | Run on a physical ARM64 Android device |
| `building for iOS Simulator, but linking in object file built for iOS` | Flutter selected an iOS Simulator | Select a physical iOS device |
| `CocoaPods not installed or not in valid state` | iOS native dependencies were not resolved | Install CocoaPods, run `pod install --repo-update`, and retry |

## Next steps

- [Add real-time camera effects to a Flutter app](/docs/effects/quickstart/flutter/)
- [Get and apply a licence key](/docs/effects/license-key/)
- [Check Flutter capability support](/docs/effects/platform-support/)
- [Apply a beauty filter in Flutter](/docs/effects/guides/effects/apply-a-beauty-filter/flutter/)
- [Control a camera game in Flutter](/docs/effects/guides/effects/control-a-camera-game/flutter/)

## References

- [nosmai_effects_sdk on pub.dev](https://pub.dev/packages/nosmai_effects_sdk)
- [Flutter package repository](https://github.com/nosmai/nosmai_effects_sdk_flutter)
- [Android native releases](https://github.com/nosmai/nosmai_effects_sdk_android/releases/latest)
- [Nosmai Effects](https://nosmai.com/effects/)
