Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions sites/docs/src/content/deployment/flavors.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,10 +386,9 @@ configure for a specific Android product flavor, see
Android's [Configure build variants][].

While it is possible to set `abiFilters` in product flavors, it is not
recommended. Instead, favor `abiFilters` in build types. When setting
`abiFilters` in product flavors, one must use the
`-Pdisable-abi-filtering` flag when running `flutter build` or
`flutter run`.
recommended. Prefer configuring `abiFilters` in `defaultConfig` when possible.
When setting `abiFilters` in product flavors, pass
`-Pdisable-abi-filtering=true` when running `flutter build` or `flutter run`.

[Configure build variants]: https://developer.android.com/build/build-variants

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ by default to:

Because this automatic configuration happens before your `build.gradle` files
are processed, it might break custom `abiFilters` settings that depend on the
set being empty.
set being empty. Flutter can preserve `abiFilters` that you configure in
`defaultConfig`, but it can't safely preserve every `buildTypes` or
`productFlavors` ABI filter customization with the current Android Gradle
Plugin APIs.

## Migration guide
If your app doesn't customize `abiFilters`, no changes are required.
Expand All @@ -57,28 +60,32 @@ flutter build apk --splits-per-abi
This creates separate APKs for each architecture and automatically disables
the automatic `abiFilters` configuration.

### Option 2: Clear and reconfigure abiFilters
### Option 2: Configure abiFilters in defaultConfig

If you must use a single APK with custom architecture filters, clear the
automatically set filters and configure your own in your `build.gradle`.
automatically set filters and configure your own in `defaultConfig`.
For example:

```kotlin
android {
buildTypes {
release {
defaultConfig {
ndk {
// Clear the automatically set filters.
ndk.abiFilters.clear()
abiFilters.clear()
// Set your custom filters.
ndk.abiFilters.addAll(listOf("arm64-v8a"))
abiFilters.addAll(listOf("arm64-v8a"))
}
}
}
Comment thread
danyalahmed1995 marked this conversation as resolved.
```

### Disabling abiFIlters ###
It is possible, but not recommended, to disable this abi filtering. Pass the `-Pdisable-abi-filtering`flag when running `flutter build`
or `flutter run`.
### Option 3: Disable Flutter's default ABI filtering

If your app configures ABI filters in `buildTypes` or `productFlavors`,
pass `-Pdisable-abi-filtering=true` when running `flutter build` or
`flutter run`. This prevents Flutter from applying its default ABI filters,
so your build type or product flavor configuration controls which
architectures are included.

## Timeline

Expand Down
Loading