简体   繁体   English

Flutter 错误:VM 快照无效,无法从设置中推断。 - 当想要在 android 项目中包含 Flutter 模块时

[英]Flutter Error: VM snapshot invalid and could not be inferred from settings. - When want to include Flutter module in android project

Use this Option B in link to include Flutter model.使用链接中的此选项 B 以包括 Flutter model。 The project starts, but as soon as it comes to initializing the FlutterEngine, this error is thrown.项目启动了,但是一到初始化 FlutterEngine 就抛出这个错误。

2021-12-10 13:54:09.300 12446-12446/ua.silpo.android.mtest E/flutter: [ERROR:flutter/runtime/dart_vm_data.cc(18)] VM snapshot invalid and could not be inferred from settings.
    2021-12-10 13:54:09.300 12446-12446/ua.silpo.android.mtest E/flutter: [ERROR:flutter/runtime/dart_vm.cc(267)] Could not set up VM data to bootstrap the VM from.
    2021-12-10 13:54:09.300 12446-12446/ua.silpo.android.mtest E/flutter: [ERROR:flutter/runtime/dart_vm_lifecycle.cc(84)] Could not create Dart VM instance.
    2021-12-10 13:54:09.300 12446-12446/ua.silpo.android.mtest A/flutter: [FATAL:flutter/shell/common/shell.cc(144)] Check failed: vm. Must be able to initialize the VM.
    2021-12-10 13:54:09.489 12603-12603/? A/DEBUG: Abort message: '[FATAL:flutter/shell/common/shell.cc(144)] Check failed: vm. Must be able to initialize the VM.
        '
    2021-12-10 13:54:09.490 12603-12603/? A/DEBUG:     #01 pc 00000000002cdfd4  /data/app/ua.someApp.android.mtest-MaQO6akxb8zud-dIXl0K7w==/lib/arm64/libflutter.so (offset 0x2c6000)

The actions are the following and the solution:操作如下和解决方案:

  • created Flutter module.创建了 Flutter 模块。

  • used connection to android via Option B .通过选项 B使用与 android 的连接。

  • since the project had no name: app, i wrote in gradle.properties -> flutter.hostAppProjectName = myAppName由于该项目没有名称:app,我写在 gradle.properties -> flutter.hostAppProjectName = myAppName

  • my settings.gradle looked like this我的 settings.gradle 看起来像这样

    rootProject.name = "mobileAndroid" include ': app' setBinding (new Binding ([gradle: this])) evaluate (new File ( settingsDir.parentFile, './SuperApp_Frontend_Silpo/.android/include_flutter.groovy' )) rootProject.name = "mobileAndroid" include ': app' setBinding (new Binding ([gradle: this])) evaluate (new File ( settingsDir.parentFile, './SuperApp_Frontend_Silpo/.android/include_flutter.groovy' ))

But the problem was that the project had its own buildTypes, so it was necessary to write但是问题是项目有自己的buildTypes,所以需要写

staging {
matchingFallbacks = ['debug', 'release']
}

in Flutter module build.gradle在 Flutter 模块 build.gradle

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Flutter错误:VM快照无效,无法从设置中推断 - Flutter Error : VM snapshot invalid and could not be inferred from settings 从 Flutter 项目构建 APK 时出错 - Error When Building APK From Flutter Project 将flutter模块添加到android项目时无法触发onActivityResult - onActivityResult can't triggered when add flutter module to android project 从集成的 flutter 模块启动 android 项目活动? - Start android project activity from integrated flutter module? 尝试为 flutter 应用程序构建发布 apk 时出错 - 无法解析项目:flutter_image_compress - Error when attempting to build a release apk for flutter app - Could not resolve project :flutter_image_compress Flutter-从Flutter项目目录中获取64K方法DEX错误,但不是从Android项目目录中获取 - Flutter - Getting 64K methods DEX Error from the Flutter project direcory but not from the Android project directory Flutter:从 Android Intent 访问通知设置 - Flutter: access notification settings from Android Intent 在 M1 Macbook 上使用 VSCode 构建 Flutter 项目 Android 时出错 - Error when building Flutter project Android with VSCode on M1 Macbook 在android studio中用Memu play模拟器调试flutter项目报错 - Error when debugging flutter project in android studio with Memu play emulator 如何将数据从 android 模块传递到 flutter 中的 flutter 模块 - How to pass data from android module to flutter module in flutter
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM