You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Moto e22(Android12)设备Flutter项目构建运行异常求助

Moto e22(Android 12)上Flutter项目运行故障排查方案

问题详情

  • 问题1:新建未修改的Flutter项目,通过Android Studio运行按钮启动,构建成功但出现白屏,运行标签无日志;手动杀死应用后重启可正常运行。
  • 问题2:使用flutter run --verbose或flutter run --debug命令时,应用安装成功,但卡在Waiting for VM Service port to be available或Built build/app/outputs/flutter-apk/app-debug.apk提示,无法进行热重载/热重启。

环境信息

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel main, 3.21.0-17.0.pre.19, on macOS 12.6.8 21G725 darwin-x64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[!] Xcode - develop for iOS and macOS (Xcode 14.2)
    ! CocoaPods 1.12.1 out of date (1.13.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.
      To upgrade see https://guides.cocoapods.org/using/getting-started.html#updating-cocoapods for instructions.
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.2)
[✓] VS Code (version 1.84.2)
[✓] Connected device (3 available)
[✓] Network resources

! Doctor found issues in 1 category.

Logcat输出

2024-03-29 06:58:54.905   669-830   UxUtility               ven...hardware.mtkpower@1.0-service  E  notifyAppState error = NULL
2024-03-29 06:58:54.926  2937-2937  PhoneInterfaceManager   com.android.phone                    E  [PhoneIntfMgr] getCarrierPackageNamesForIntentAndPhone: No UICC
2024-03-29 06:58:54.943  3886-3886  AidRoutingManager       com.android.nfc                      E  Size of routing table804
2024-03-29 06:58:54.958   681-681   BpTransact...edListener surfaceflinger                       E  Failed to transact (-32)
2024-03-29 06:58:54.958   681-681   BpTransact...edListener surfaceflinger                       E  Failed to transact (-32)
2024-03-29 06:58:54.986   681-834   BufferQueueDebug        surfaceflinger                       E  [com.android.settings/com.android.settings.SubSettings#0](this:0xb400007a470532e8,id:-1,api:0,p:-1,c:-1) id info cannot be read from 'com.android.settings/com.android.settings.SubSettings#0'
2024-03-29 06:58:55.381   681-834   BufferQueueDebug        surfaceflinger                       E  [Splash Screen com.whimstech.driverapp.new_flutter_project#0](this:0xb400007a47069f68,id:-1,api:0,p:-1,c:-1) id info cannot be read from 'Splash Screen com.whimstech.driverapp.new_flutter_project#0'
2024-03-29 06:58:55.494   669-830   UxUtility               ven...hardware.mtkpower@1.0-service  E  notifyAppState error = NULL
2024-03-29 06:58:55.633  6026-6043  OpenGLRenderer          com.android.settings                 E  EglManager::makeCurrent mED = 0x1, surface = 0x0, mEC = 0xb4000078bd6be650, error = EGL_SUCCESS
2024-03-29 06:58:55.741  6249-6271  QT                      pid-6249                             E  [QT]file does not exist
2024-03-29 06:58:56.370   681-835   BufferQueueDebug        surfaceflinger                       E  [com.whimstech.driverapp.new_flutter_project/com.whimstech.driverapp.new_flutter_project.MainActivity#0](this:0xb400007a47042188,id:-1,api:0,p:-1,c:-1) id info cannot be read from 'com.whimstech.driverapp.new_flutter_project/com.whimstech.driverapp.new_flutter_project.MainActivity#0'
2024-03-29 06:58:56.400  6249-6269  OpenGLRenderer          com...driverapp.new_flutter_project  E  EglManager::makeCurrent mED = 0x1, surface = 0x0, mEC = 0xb4000078bd6b8110, error = EGL_SUCCESS
2024-03-29 06:58:56.400   681-835   BufferQueueDebug        surfaceflinger                       E  [SurfaceView[com.whimstech.driverapp.new_flutter_project/com.whimstech.driverapp.new_flutter_project.MainActivity](BLAST)#0](this:0xb400007a47056078,id:-1,api:0,p:-1,c:-1) id info cannot be read from 'SurfaceView[com.whimstech.driverapp.new_flutter_project/com.whimstech.driverapp.new_flutter_project.MainActivity](BLAST)#0'
2024-03-29 06:58:56.407   681-835   HWComposer              surfaceflinger                       E  getSupportedContentTypes: getSupportedContentTypes failed for display 0: Unsupported (8)
2024-03-29 06:58:56.413  6249-6276  ion                     com...driverapp.new_flutter_project  E  ioctl c0044901 failed with code -1: Invalid argument
2024-03-29 06:59:00.457 24427-4404  WakeLock                com.google.android.gms.persistent    E  GCM_HB_ALARM release without a matched acquire!
2024-03-29 06:59:00.470  6249-6269  OpenGLRenderer          com...driverapp.new_flutter_project  E  fbcNotifyFrameComplete error: undefined symbol: fbcNotifyFrameComplete
2024-03-29 06:59:00.470  6249-6269  OpenGLRenderer          com...driverapp.new_flutter_project  E  fbcNotifyNoRender error: undefined symbol: fbcNotifyNoRender

Flutter Run Verbose输出

[  +13 ms] Stopping app 'app-debug.apk' on moto e22.
[   +1 ms] executing: /Users/ibtihajnaeem/Library/Android/sdk/platform-tools/adb -s ZE2235Q3DM shell am force-stop
com.whimstech.driverapp.new_flutter_project
[ +202 ms] executing: /Users/ibtihajnaeem/Library/Android/sdk/platform-tools/adb -s ZE2235Q3DM shell pm list packages
com.whimstech.driverapp.new_flutter_project
[ +106 ms] package:com.whimstech.driverapp.new_flutter_project
[   +5 ms] executing: /Users/ibtihajnaeem/Library/Android/sdk/platform-tools/adb -s ZE2235Q3DM shell cat
/data/local/tmp/sky.com.whimstech.driverapp.new_flutter_project.sha1
[  +85 ms] d398535fddb940e49abe5dd0a43b3932ccf5e1be
[   +1 ms] Latest build already installed.
[   +2 ms] executing: /Users/ibtihajnaeem/Library/Android/sdk/platform-tools/adb -s ZE2235Q3DM shell -x logcat -v time -t 1
[  +92 ms] --------- beginning of main
           03-29 07:25:16.521 E/BpTransactionCompletedListener(  681): Failed to transact (-32)
[  +21 ms] executing: /Users/ibtihajnaeem/Library/Android/sdk/platform-tools/adb -s ZE2235Q3DM shell am start -a android.intent.action.MAIN -c
android.intent.category.LAUNCHER -f 0x20000000 --ez enable-dart-profiling true --ez enable-checked-mode true --ez verify-entry-points true
com.whimstech.driverapp.new_flutter_project/com.whimstech.driverapp.new_flutter_project.MainActivity
[ +124 ms] Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x20000000
cmp=com.whimstech.driverapp.new_flutter_project/.MainActivity (has extras) }
[   +1 ms] Waiting for VM Service port to be available...

解决方案

结合日志中SurfaceFlinger、OpenGL相关报错及Moto e22的联发科芯片特性,尝试以下步骤:

  1. 切换Flutter到稳定版
    当前使用的main频道预览版稳定性不足,执行以下命令切换:
flutter channel stable
flutter upgrade
  1. 禁用Activity硬件加速
    在Android项目的AndroidManifest.xml中,为MainActivity添加禁用属性:
<activity
    android:name=".MainActivity"
    android:hardwareAccelerated="false"
    ...>
  1. 强制Flutter使用软件渲染
    在main.dart初始化时添加渲染模式配置:
void main() {
  WidgetsFlutterBinding.ensureInitialized();
  if (defaultTargetPlatform == TargetPlatform.android) {
    AndroidViewController.instance!.setSurfaceRenderMode(SurfaceRenderMode.surface);
  }
  runApp(const MyApp());
}
  1. 重置ADB连接
adb kill-server
adb start-server
adb devices
  1. 清理项目缓存
flutter clean
flutter pub get
cd android && ./gradlew clean
cd ..

内容的提问来源于stack exchange,提问作者Muhammad Ibtihaj Naeem

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.27 01:37:04