Skip to content
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
title: Flutter now sets default `abiFilters` in Android builds
description: >-
The Flutter Gradle Plugin now automatically configures abiFilters
for Android builds, which might override custom abiFilters settings.
---

## Summary

Starting in Flutter 3.35, the Flutter Gradle Plugin automatically sets
`abiFilters` for Android builds to prevent the inclusion of unsupported
architectures in release APKs. This change can override custom
`abiFilters` specified in your app's `build.gradle` file.

## Context

This change was introduced to solve an issue where third-party
dependencies with x86 native libraries would cause Google Play to
incorrectly identify Flutter apps as supporting x86 devices. When users
with x86 devices installed these apps, they would crash at runtime
because Flutter's native libraries aren't available for x86.

The Flutter Gradle Plugin now automatically configures `abiFilters` to
include only the architectures that Flutter supports. This prevents
Google Play from making apps available to incompatible devices.

## Description of change

The Flutter Gradle Plugin now programmatically sets `abiFilters` for
non-debuggable builds when the `--splits-per-abi` option is not enabled
by default to:
- `armeabi-v7a`
- `arm64-v8a`
- `x86_64`

Because this automatic configuration happens after your `build.gradle` files
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not exactly correct - the configuration happens before. It just breaks those who were depending on the set to be empty.

Previously, it would be. Now we add elements to it during configuration that happens before the user's build.gradle file. This is why clearing still works (otherwise it wouldn't matter what they wrote in their build.gradle at all).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhh I see I see. Corrected "after" to "before"!

are processed, it might override custom `abiFilters` settings.

## Migration guide
If your app doesn't customize `abiFilters`, no changes are required.

If your app needs to customize which architectures are included, you have
several options:

### Option 1: Use the splits-per-abi flag

If you want to control architecture inclusion, use Flutter's built-in
`--splits-per-abi` option instead of manually configuring `abiFilters`:

```console
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

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

```kotlin
android {
buildTypes {
release {
// Clear the automatically set filters.
ndk.abiFilters.clear()
// Set your custom filters.
ndk.abiFilters.addAll(listOf("arm64-v8a"))
}
}
}
```

## Timeline

Landed in version: 3.35.0<br>
In stable release: 3.35

Relevant issues:
* [Issue #174004]({{site.repo.flutter}}/issues/174004)
* [Issue #153476]({{site.repo.flutter}}/issues/153476)

Relevant PRs:
* [PR #168293]({{site.repo.flutter}}/pull/168293)

2 changes: 2 additions & 0 deletions src/content/release/breaking-changes/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,14 @@ They're sorted by release and listed in alphabetical order:
* [Redesigned the `Radio` widget][]
* [Removed semantics elevation and thickness][]
* [The `Form` widget no longer supports being a sliver][]
* [Flutter now sets default `abiFilters` in Android builds][]

[Component theme normalization updates]: /release/breaking-changes/component-theme-normalization-updates
[Deprecate `DropdownButtonFormField` `value` parameter in favor of `initialValue`]: /release/breaking-changes/deprecate-dropdownbuttonformfield-value
[Redesigned the `Radio` Widget]: /release/breaking-changes/radio-api-redesign
[Removed semantics elevation and thickness]: /release/breaking-changes/remove-semantics-elevation-and-thickness
[The `Form` widget no longer supports being a sliver]: /release/breaking-changes/form-semantics
[Changed how to add ABI filters on Android]: /release/breaking-changes/default-abi-filters-android

<a id="released-in-flutter-332" aria-hidden="true"></a>
### Released in Flutter 3.32
Expand Down