flutter / flutter/flutter

Lag in Animations After Upgrading to Flutter 3.24 on Some Android Devices (Huawei Redmi Note 13, ...)

Open
#162,861 11 comments 1 reaction 0 assignees View on GitHub
a: animation c: performance e: device-specific P2 platform-android team-android triaged-android
Dominant language
Dart
Stars
179k
Forks
31.1k
PR merge metrics
PR metrics pending

Description

### Steps to reproduce

After upgrading from Flutter 3.22 to 3.24, our team got report from some users about animation stutters, frame drops. These issues occur across various animations, such as routing transitions, UI updates, and even simple widget animations.

Video is attatched below.

> Our service updated flutter to 3.24 last year. We ignored such reports from users because we could not reproduce it. However, our team acquired a new testing device (Huawei Redmi Note 13), we were able to reproduce and confirm the issue.

This issue has been reported on multiple devices: Galaxy S23, Galaxy Note 20, Huawei Redmi Note 13.

However, this does not appear to be strictly device(model) specific, as some users with the same device models have reported no issues.

We tested this issue using a minimal Flutter app without any third-party dependencies, confirming that the problem exists even in a basic setup.

Additional Information:
- This issue is current on latest flutter stable version (3.27.4)
- I have tried [Both enabling, disabling Impeller engine](https://docs.flutter.dev/perf/impeller#android)
- Huawei Redmi Note 13 supports Vulkan (checked by installing Hardware [CapsViewer for Vulkan](https://play.google.com/store/apps/details?id=de.saschawillems.vulkancapsviewer&hl=en_US) )

### Code sample

TweenAnimationBuilder Example

```dart
import 'dart:async';

import 'package:flutter/material.dart';

void main() {
runApp(const MyApp());
}

class MyApp extends StatelessWidget {
const MyApp({super.key});

@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Test',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Flutter Test'),
);
}
}

class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});

final String title;

@override
State createState() => _MyHomePageState();
}

class _MyHomePageState extends State {
late final Timer _timer;

@override
void initState() {
super.initState();
_timer = Timer.periodic(const Duration(milliseconds: 250), (timer) {
if (progress >= 1) {
progress = 0;
} else {
progress += 0.2;
}
setState(() {});
});
}

@override
void dispose() {
_timer.cancel();
super.dispose();
}

double progress = 0;

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
TweenAnimationBuilder(
duration: const Duration(milliseconds: 250),
curve: Curves.easeInOut,
tween: Tween(
begin: 0,
end: progress,
),
builder: (context, value, _) => LinearProgressIndicator(
value: value,
minHeight: 8,
color: Theme.of(context).colorScheme.primary,
backgroundColor: Theme.of(context).colorScheme.surface,
borderRadius: BorderRadius.circular(5),
),
),
],
),
),
);
}
}

```

### Performance profiling on master channel

- [x] The issue still persists on the master channel

### Timeline Traces

Timeline Traces JSON

```json
[Paste the Timeline Traces here]
```

### Video demonstration

Video demonstration

[video with performance issue](https://github.com/user-attachments/assets/d1222518-16e5-41b1-a332-a3b3b5bf8799)
[expected](https://github.com/user-attachments/assets/0f170229-3277-4428-bbfa-f331267bf5d1)

### What target platforms are you seeing this bug on?

Android

### OS/Browser name and version | Device information

Huawei Redmi Note 13 (Android 13)

### Does the problem occur on emulator/simulator as well as on physical devices?

Unknown

### Is the problem only reproducible with Impeller?

Yes

### Logs

Logs

```console
[Paste your logs here]
```

### Flutter Doctor output

Doctor output

```console

[✓] Flutter (Channel stable, 3.24.0, on macOS 14.5 23F79 darwin-arm64, locale ko-KR)
• Flutter version 3.24.0 on channel stable at /Users/{ME}/fvm/versions/3.24.0
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 80c2e84975 (6 months ago), 2024-07-30 23:06:49 +0700
• Engine revision b8800d88be
• Dart version 3.5.0
• DevTools version 2.37.2

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/{ME}/Library/Android/sdk
• Platform android-35, build-tools 34.0.0
• Java binary at: /opt/homebrew/opt/openjdk@17/bin/java
• Java version OpenJDK Runtime Environment Homebrew (build 17.0.13+0)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 16B40
• CocoaPods version 1.16.2

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.2.1)
• IntelliJ at /Applications/IntelliJ IDEA.app
• Flutter plugin version 79.0.1
• Dart plugin version 232.10313

[✓] VS Code (version 1.96.4)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.102.0

[✓] Connected device (4 available)
• 23124RA7EO (mobile) • 591d72fd • android-arm64 • Android 13 (API 33)
• macOS (desktop) • macos • darwin-arm64 • macOS 14.5 23F79 darwin-arm64
• Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 14.5 23F79 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 132.0.6834.160

[✓] Network resources
• All expected network resources are available.
```

23124RA7EO (mobile) device which shows on Connected device is device which with issue (Huawei Redmi Note 13)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.