Flutter Error: VM snapshot invalid and could not be inferred from settings. - When want to include Flutter module in android project
Flutter Error: VM snapshot invalid and could not be inferred from settings. - When want to include Flutter module in android project
使用 link 中的选项 B 来包含 Flutter 模型。
项目启动,但是刚开始初始化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)
操作如下及解决方法:
创建了 Flutter 模块。
通过Option B连接到android。
因为项目没有名字:app,
我写在 gradle.properties -> flutter.hostAppProjectName = myAppName
我的settings.gradle看起来像这样
rootProject.name = "移动安卓"
包括':应用程序'
setBinding(新绑定([gradle:这个]))
评估(新文件(
settingsDir.parentFile,
'./SuperApp_Frontend_Silpo/.android/include_flutter.groovy'
))
但问题是项目有自己的buildTypes,所以需要这样写
staging {
matchingFallbacks = ['debug', 'release']
}
在 Flutter 模块中 build.gradle
使用 link 中的选项 B 来包含 Flutter 模型。 项目启动,但是刚开始初始化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)
操作如下及解决方法:
创建了 Flutter 模块。
通过Option B连接到android。
因为项目没有名字:app, 我写在 gradle.properties ->
flutter.hostAppProjectName = myAppName
我的settings.gradle看起来像这样
rootProject.name = "移动安卓" 包括':应用程序' setBinding(新绑定([gradle:这个])) 评估(新文件( settingsDir.parentFile, './SuperApp_Frontend_Silpo/.android/include_flutter.groovy' ))
但问题是项目有自己的buildTypes,所以需要这样写
staging {
matchingFallbacks = ['debug', 'release']
}
在 Flutter 模块中 build.gradle