1 What it is the problem?
There is a file descriptor leak problem in Flutter. And you Konw that every android phone has a limit of maximum file descriptor. when your application fd(file descriptor) is bigger than the maximum fd,your application will be crash.
2 How to repeat this problem?
this is demo source code
you can run this project and dont need to modify any code but just print the below log
Log.i("TAG", "onCreate: getFdCount " + ProcessUtil.getFdCount());
when you print this log for 5 minutes, you can find the number will be bigeer and bigger.
please use non-Qualcomm cpu mobile phone to test this problem , Qualcomm cpu phone cant repeate this question, May be Flutter cant support other cpu ?
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel unknown, v1.17.112, on macOS 11.4 20F71, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[!] Xcode - develop for iOS and macOS (Xcode 12.5)
! CocoaPods 1.5.3 out of date (1.8.0 is recommended).
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To upgrade:
sudo gem install cocoapods
[✓] Android Studio (version 4.1)
[!] Connected device
! No devices available
! Doctor found issues in 2 categories.
1 What it is the problem?
There is a file descriptor leak problem in Flutter. And you Konw that every android phone has a limit of maximum file descriptor. when your application fd(file descriptor) is bigger than the maximum fd,your application will be crash.
2 How to repeat this problem?
this is demo source code
you can run this project and dont need to modify any code but just print the below log
Log.i("TAG", "onCreate: getFdCount " + ProcessUtil.getFdCount());when you print this log for 5 minutes, you can find the number will be bigeer and bigger.
Doctor summary (to see all details, run flutter doctor -v):