Closed ghost closed 4 years ago
@TahaTesser commented on Mar 6, 2020, 8:23 AM UTC:
Hi @Adgeros
can you please provide your flutter doctor -v
and flutter run --verbose
?
Also, to better address the issue, would be helpful if you could post a minimal code sample to reproduce the problem
Thank you
@Adgeros commented on Mar 6, 2020, 8:43 AM UTC:
I opened up the android project, the compile succeeded, but the ide reported an error
flutter doctor -v
[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.18363.657], locale zh-CN)
• Flutter version 1.12.13+hotfix.8 at D:\Flutter\flutter
• Framework revision 0b8abb4724 (3 weeks ago), 2020-02-11 11:44:36 -0800
• Engine revision e1e6ced81d
• Dart version 2.7.0
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at D:\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-R, build-tools 29.0.3
• ANDROID_HOME = D:\Android\sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
• All Android licenses accepted.
[√] Android Studio (version 3.6)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 44.0.2
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[!] Connected device
• Device 75ABBKM22SWH is not authorized.
You might need to check your device for an authorization dialog.
! Doctor found issues in 1 category.
flutter run --verbose
compile succeeded
@TahaTesser commented on Mar 6, 2020, 12:38 PM UTC:
Hi @Adgeros
Have you modified your build.gradle
in anyway?
Can you post your build.gradle
?
Thank you
@glitchedmob commented on Mar 6, 2020, 8:32 PM UTC:
I think this issue might have something to do with a recent version of the Kotlin plugin for Android Studio. I had run into the error shortly after installing a recent update of that plugin. I created a brand new flutter project to make sure it wasn't just something weird with the project I was working on and I was still seeing this error there. After removing the plugin update I had installed the error disappeared.
I could be wrong but it appears to be what was causing issues for me.
@KohlsAdrian commented on Mar 6, 2020, 11:44 PM UTC:
I think it is related to the new 1.3.70 kotlin version
downgrading may fix the issue
@Skyost commented on Mar 10, 2020, 10:08 PM UTC:
Got the same error with 1.3.50
kotlin version. I have the same flutter doctor -v
result than @Adgeros.
@KohlsAdrian commented on Mar 10, 2020, 10:12 PM UTC:
try 1.3.61
@Skyost commented on Mar 10, 2020, 10:29 PM UTC:
Thanks for your help @KohlsAdrian but it's still not working.
EDIT :
Gradle version : 5.6.4
flutter doctor -v
:
[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [version 10.0.17763.1039], locale fr-FR)
• Flutter version 1.12.13+hotfix.8 at D:\Hugo\Programmes\Flutter
• Framework revision 0b8abb4724 (4 weeks ago), 2020-02-11 11:44:36 -0800
• Engine revision e1e6ced81d
• Dart version 2.7.0
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.0-rc1)
• Android SDK at D:\Hugo\Programmes\Android\SDK
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 30.0.0-rc1
• ANDROID_HOME = D:\Hugo\Programmes\Android\SDK
• Java binary at: D:\Hugo\Programmes\Android\Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
• All Android licenses accepted.
[√] Android Studio (version 3.6)
• Android Studio at D:\Hugo\Programmes\Android\Studio
• Flutter plugin version 44.0.2
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[√] Connected device (1 available)
• AOSP on IA Emulator • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)
• No issues found!
build.gradle
:
buildscript {
ext.kotlin_version = '1.3.70'
ext {
compileSdkVersion = 29
targetSdkVersion = 29
appCompatVersion = "1.0.2"
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
@mweiczorek commented on Mar 11, 2020, 8:29 AM UTC:
Same issue here. I work on the Flutter project with VS Code, but I needed to open it in Android Studio to add a library to the native side of the project, and I get this same error with Kotlin 1.3.50. The fact that we're all getting the same errors with different versions of Kotlin would suggest the problem does not lie with Kotlin.
@mweiczorek commented on Mar 11, 2020, 9:17 AM UTC:
Update. The FlutterActivity implements android.arch.lifecycle.LifecycleOwner
, but the android.arch
package is missing from my SDK.
Another issue is that the app/build.gradle
file specifies API version 28, but the libraries show 29
android {
compileSdkVersion 28
....
defaultConfig {
....
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
}
I haven't changed anything in either gradle file. All SDK's listed int eh SDK manager are labeled as 'Installed'.
This project was created in the terminal with flutter create
. This works perfectly using the emulator via the VS Code debugger, even with the missing package.
I created a new Flutter project using Adroid Studio with the exact same result.
I've looked at this link regarding adding this dependency manually (even though I am not using androidx
artifacts, the method should be the same), but any change I make to the gradle file does not result in anything being downloaded and installed. In the past, when I build a native Android app with Java, any edits made to the gradle would immediately trigger the update (as indicated by a progress indicator at the right of the application's status bar). With this, nothing happens.
I should also note that I have no gradle functionality, and I have no way to open the "Project Settings" dialog.
@Adgeros commented on Mar 12, 2020, 1:19 AM UTC:
I uninstalled the kotlin plugin to solve this problem
@jeromoney commented on Mar 12, 2020, 4:18 PM UTC:
I fixed this issue by downgrading my Kotlin plugin from 1.3.70-release-Studio3.6-1 to 1.3.61-release-Studio3.6-1 Even with the bug, Kotlin would compile just fine (flutter run), just wouldn't have access to the nice IDE features.
@blasten commented on Mar 12, 2020, 8:43 PM UTC:
Did you follow the steps outlined on https://flutter.dev/docs/development/androidx-migration? That error message indicates you haven’t migrated to AndroidX
@Skyost commented on Mar 12, 2020, 9:39 PM UTC:
Yep. In fact, my project has been created using flutter 1.12.
@xster commented on Mar 13, 2020, 1:35 AM UTC:
Can someone who can still reproduce this issue share their full app/build.gradle file (please remove PII) for us to better understand the issue?
Please also describe how you did the integration from https://flutter.dev/docs/development/add-to-app/android/project-setup. Also confirm that
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
is present.
@bjzhou commented on Mar 13, 2020, 1:20 PM UTC:
Can someone who can still reproduce this issue share their full app/build.gradle file (please remove PII) for us to better understand the issue?
Please also describe how you did the integration from https://flutter.dev/docs/development/add-to-app/android/project-setup. Also confirm that
compileOptions { sourceCompatibility 1.8 targetCompatibility 1.8 }
is present.
Android Studio: 3.6.1
for me, new project created by File -> New -> New Flutter Project
can reproduce this issue too.
@Skyost commented on Mar 13, 2020, 1:55 PM UTC:
@xster That was not added in my build.gradle
. I've added it, did a refresh restart and still have the same error. Here's my project if you want.
@faithang commented on Mar 14, 2020, 1:16 AM UTC:
I also have this same issue. I have uninstalled and installed the Kotlin plugin multiple times to no avail. Problem still persists. I am using the latest version of Kotlin, 1.3.70. I created my project with AndroidX artifacts - does that still mean I have to do the migration?
To reproduce the issues, I create a new Flutter project through File > New > New Flutter Project
.
flutter doctor -v
[✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Mac OS X 10.15.3 19D76,
locale en-GB)
• Flutter version 1.12.13+hotfix.8 at /Users/faith/Documents/flutter
• Framework revision 0b8abb4724 (4 weeks ago), 2020-02-11 11:44:36 -0800
• Engine revision e1e6ced81d
• Dart version 2.7.0
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/faith/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling
support)
• Platform android-29, build-tools 29.0.2
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_212-release-1586-b4-5784211)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.3.1, Build version 11C504
• CocoaPods version 1.9.1
[✓] Android Studio (version 3.6)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 44.0.2
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build
1.8.0_212-release-1586-b4-5784211)
[✓] VS Code (version 1.43.0)
• VS Code at /Users/faith/Applications/Visual Studio Code.app/Contents
• Flutter extension version 2.21.1
[✓] Connected device (2 available)
• AOSP on IA Emulator • emulator-5554 • android-x86 •
Android 9 (API 28) (emulator)
• iPhone 11 Pro Max • 570D77CB-B188-47E9-AFE7-8FE8EA64CDD3 • ios •
com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)`
app build-gradle
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 28
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
applicationId "com.lwn.lwntracker2"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
@xuyisheng commented on Mar 14, 2020, 2:05 AM UTC:
I have the same error, but the app can run as well, only the error lint in AS.
@Bottlezn commented on Mar 15, 2020, 11:52 AM UTC:
My solution was downgrade the Kotlin Plguin from 1.3.70 to 1.3.61. I meet the same lint error when i update the Kotlin Plguin from 1.3.61 to 1.3.70.Although my app still can run in debug-mode or release-mode. It's was gone when i uninstall the updated Kotlin Plguin. btw,my version of Android Stuido was 3.6.1_192.7142.36.36.6241897.
@dbacinski commented on Mar 16, 2020, 7:25 AM UTC:
I am having the same error with Android Studio Koltin Plugin 1.3.70, but the app runs correctly.
With Kotlin Plugin 1.3.61, the error is not present.
The problem is that FlutterActivity (and other flutter classes) depend on old support libraries and not androidx.
package io.flutter.embedding.android;
import android.arch.lifecycle.Lifecycle;
import android.arch.lifecycle.LifecycleOwner;
import android.arch.lifecycle.LifecycleRegistry;
public class FlutterActivity extends Activity
implements FlutterActivityAndFragmentDelegate.Host,
LifecycleOwner {
android.enableJetifier=true
is used to automatically convert dependencies to androidx during the build process (and not before).
To solve this issue we should also have Flutter artifacts that depend on androidx and don't need to use enableJetifier.
@KohlsAdrian commented on Mar 16, 2020, 1:35 PM UTC:
This is my default class, with just registerWith(this)
for firebase related plugins:
Project build.gradle(project) with latest kotlin plugin:
This guy fixed my lint errors in build.gradle(app)
Delete all *.iml
files, and delete .idea
folder inside android/app folder, sometimes references are broken causing lint errors
Doing all these steps will fix most errors, I have this kind of issues constantly, if you get this fixed, make a feedback, I think I must be very important in this issue helping you guys, solved many things alone and never shared
@xuyisheng commented on Mar 17, 2020, 10:17 AM UTC:
This is my default class, with just
registerWith(this)
for firebase related plugins:Project build.gradle(project) with latest kotlin plugin:
This guy fixed my lint errors in build.gradle(app)
Delete all
*.iml
files, and delete.idea
folder inside android/app folder, sometimes references are broken causing lint errorsDoing all these steps will fix most errors, I have this kind of issues constantly, if you get this fixed, make a feedback, I think I must be very important in this issue helping you guys, solved many things alone and never shared
I'm afraid it is not work for me ,I don't know why, I only update kotlin plugin to 1.3.70, sad
@dbacinski commented on Mar 17, 2020, 10:28 AM UTC:
I am afraid that it can't be fixed without either fix in Kotlin Plugin that would respect enableJetifier=true
or Flutter flavor of dependencies that depend on androidx.
Flutter part is pending release flutter/engine#17075
@KohlsAdrian commented on Mar 17, 2020, 3:37 PM UTC:
I am really sad that is not working for you guys, for me it is working flawlessly and perfect
@xster commented on Mar 18, 2020, 1:38 AM UTC:
I've been trying to reproduce but haven't been able to so far. Trying on Android Studio 3.6.1. Gradle 5.6.4, Android gradle plugin 3.6.1, kotlin 1.3.70. I'm seeing emulators in the flutter doctors so I'm trying API 28 x86 emulators like described above. I'm still not able to reproduce.
I'm assuming using plugins are needed to reproduce this perhaps?
Could someone confirm the exact set of conditions needed to reproduce this plus the list of plugins used?
@bctpl commented on Mar 18, 2020, 6:27 AM UTC:
I've been trying to reproduce but haven't been able to so far. Trying on Android Studio 3.6.1. Gradle 5.6.4, Android gradle plugin 3.6.1, kotlin 1.3.70. I'm seeing emulators in the flutter doctors so I'm trying API 28 x86 emulators like described above. I'm still not able to reproduce.
I'm assuming using plugins are needed to reproduce this perhaps?
Could someone confirm the exact set of conditions needed to reproduce this plus the list of plugins used?
It's produce issue everytime I created File -> New -> New Flutter Project
I have latest version of kotlin and downgrading kotlin version not solving issue.
I'm using android studio in Windows 10
@bjzhou commented on Mar 18, 2020, 6:43 AM UTC:
@xster my my project can produce this issue on windows computer, but works perfect on macOS.
@xster commented on Mar 21, 2020, 1:22 AM UTC:
I was trying on the Android Studio Kotlin plugin 1.3.70-release-Studio3.6-1.
Can someone describe the complete repro environments so I can try to replicate? (though I only have a mac at home).
AS version, Flutter version, gradle version, Android Gradle Plugin version, ideally a project in GitHub we can directly download and try to reproduce.
@Skyost commented on Mar 21, 2020, 11:03 AM UTC:
@xster, flutter doctor & gradle + my project on Github. My Android Studio specs :
Android Studio 3.6.1
Build #AI-192.7142.36.36.6241897, built on February 27, 2020
Runtime version: 1.8.0_212-release-1586-b04 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 1246M
Cores: 4
Registry: ide.new.welcome.screen.force=true
Non-Bundled Plugins: com.thoughtworks.gauge, com.vladsch.idea.multimarkdown, org.jetbrains.kotlin, com.google.services.firebase, Dart, io.flutter, pl.pszklarska.pubversionchecker
@dev-horacebg commented on Mar 21, 2020, 2:27 PM UTC:
This happens for me literally every single time I create a new Flutter project.
My setup:
macOS Catalina: 10.15.3 (19D76)
Android Studio 4.0 Beta 1
Build #AI-193.6494.35.40.6220182, built on February 19, 2020
Runtime version: 1.8.0_212-release-1586-b4-5784211 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.15.3
GC: ParNew, ConcurrentMarkSweep
Memory: 3987M
Cores: 16
Registry: ide.new.welcome.screen.force=true
Non-Bundled Plugins: BashSupport, Dart, org.jetbrains.kotlin, io.flutter, com.azoft.json2dart, com.localizely.flutter-intl, com.squareup.sqldelight
Flutter doctor:
[✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Mac OS X 10.15.3 19D76, locale en-GB)
• Flutter version 1.12.13+hotfix.8 at /Users/horacebell-gam/flutter
• Framework revision 0b8abb4724 (6 weeks ago), 2020-02-11 11:44:36 -0800
• Engine revision e1e6ced81d
• Dart version 2.7.0
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/horacebell-gam/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: /Applications/Android Studio 3.6 Preview.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.3.1, Build version 11C504
• CocoaPods version 1.9.1
[!] Android Studio (version 3.6)
• Android Studio at /Applications/Android Studio 3.6 Preview.app/Contents
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
[!] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[✓] Android Studio
• Android Studio at /Applications/Android Studio 4.0 Preview.app/Contents
• Flutter plugin version 44.0.3
• Dart plugin version 193.6494.35
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
[!] IntelliJ IDEA Community Edition (version 2019.2.4)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• For information about installing plugins, see
https://flutter.dev/intellij-setup/#installing-the-plugins
[✓] Connected device (2 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• iPhone 11 Pro Max • 151EC602-72B6-4D2A-AC47-C14835B31A70 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)
! Doctor found issues in 3 categories.
On this machine, I only use Flutter on Android Studio 4.0. I've tried this with Kotlin plugins 1.3.50, 1.3.61 and 1.3.70 to no avail.
As others have mentioned above; the project still compiles and works as it should, it's just very difficult to write any Android code when everything is an error.
Here is a simple repo (an untouched default Flutter app) that demonstrates the issue.
@andvalsol commented on Mar 26, 2020, 10:28 PM UTC:
is there any advance on this topic, I'm getting the exact same error. Also I can't see where I can add swift file in Android Studio
@xuyisheng commented on Mar 28, 2020, 2:25 AM UTC:
Kotlin plugin 1.3.71 has the same error.
@YugeCse commented on Mar 29, 2020, 10:32 AM UTC:
I have got the error,too, The situation is the same as theirs.
@pinhassi commented on Mar 31, 2020, 8:39 AM UTC:
The error is caused due to Kotlin plugin v1.3.71 You download previous version and manually install it: IntelliJ IDEA -> Preferences -> Plugins -> install plugin from disk I opened an issue at JetBrains
no-response[bot] commented on Apr 2, 2020, 9:34 PM UTC:
Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away! Thanks for your contribution.
@xster commented on Apr 2, 2020, 9:46 PM UTC:
This shouldn't be closed. Reopening.
no-response[bot] commented on Apr 2, 2020, 10:37 PM UTC:
Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away! Thanks for your contribution.
@xkeyC commented on Apr 5, 2020, 8:52 AM UTC:
I uninstalled the kotlin plugin to solve this problem too!
@akadatsky commented on Apr 7, 2020, 8:05 AM UTC:
@xster @Adgeros Any solution without uninstalling kotlin plugin?
@maddenbrain commented on Apr 9, 2020, 12:59 PM UTC:
I still have this issue in my project.
@xkeyC commented on Apr 9, 2020, 1:02 PM UTC:
I still have this issue in my project.
You can try downgrade your kotlin plugin
@maddenbrain commented on Apr 9, 2020, 1:12 PM UTC:
I still have this issue in my project.
You can try downgrade your kotlin plugin
This is not the solution to The Problem. We have a pretty big and old project, there kotlin is main language. We are using latest kotlin features. And currently flutter added as a module. We are researching opportunities we can get with flutter. So we can easily remove flutter because of bugs.
@yy1300326388 commented on Apr 11, 2020, 3:33 PM UTC:
I am following here to upgrade my plugin, when I visit ActivityControlSurface.java
, it prompts me to find To Lifecycle
, my plugin is supported by AndroidX
, so I think it is caused by io.flutter.embedding
without migrating AndroidX.
@xster @TahaTesser
@ochrin commented on Apr 11, 2020, 4:23 PM UTC:
I have same issue with Kotlin 1.3.71 plugin. I just enabled code completion, restarted Android Studio, but the problem is still here...
@Adgeros commented on Mar 6, 2020, 5:20 AM UTC:
This issue was moved by xster from flutter/flutter#52077.