集成flutter错误:VM snapshot must be valid

E/flutter: [ERROR:flutter/runtime/dart_vm.cc(265)] VM snapshot must be valid.
A/flutter: [FATAL:flutter/shell/common/shell.cc(208)] Check failed: vm. Must be able to initialize the VM.
A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 20133 (m.dbn.OAConnect)

assets 目录会缺少 flutter_shared 资源。在打包的时候没有把 flutter.jar 中 assets 资源合并到项目的 assets 中。flutter_shared 文件夹中有一个非常重要的 icudtl.dat 文件

modify packages/flutter_tools/gradle/flutter.gradle

最终解决了@jelenalecic

  1. Import flutter module to your HOST app(set binding, implementation, and instantiate view/fragment)
  2. When you clean/rebuild from HOST app, flutter module does not generate properly
  3. You need to open your flutter module in a separate AS
  4. flutter clean
  5. cd .android
  6. gradlew clean
  7. gradlew assembleDebug
  8. Return to host app and run app(do not sync or rebuild) :)
    原文作者:MDZZ灭顶之灾12138
    原文地址: https://www.jianshu.com/p/adb76e6b6b7f
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞