Android release调用Flutter崩溃

问题

Flutter混合开发Android debug正常, Android release调用Flutter崩溃问题

2021-11-26 22:17:35.057 9897-9897/com.jjmc.esurgerytest E/flutter: [ERROR:flutter/runtime/dart_vm_data.cc(18)] VM snapshot invalid and could not be inferred from settings.
2021-11-26 22:17:35.057 9897-9897/com.jjmc.esurgerytest E/flutter: [ERROR:flutter/runtime/dart_vm.cc(256)] Could not set up VM data to bootstrap the VM from.
2021-11-26 22:17:35.057 9897-9897/com.jjmc.esurgerytest E/flutter: [ERROR:flutter/runtime/dart_vm_lifecycle.cc(84)] Could not create Dart VM instance.
2021-11-26 22:17:35.057 9897-9897/com.jjmc.esurgerytest A/flutter: [FATAL:flutter/shell/common/shell.cc(143)] Check failed: vm. Must be able to initialize the VM.

解决方案

项目配置了 debuggable 为true 为了方便release环境也能 看到日志,由于flutter release不支持热重载,其判断可能是使用 debuggable 以为 当前需要支持热更新,去调用资源造成崩溃 

release.apk > assets Android release调用Flutter崩溃release包不存在 flutter相关 asset资源

 debug.apk > assets

Android release调用Flutter崩溃

 最终处理,删除  app build.gradle 下 

android {

        buildtypes{

        release {
                ... 
            debuggable APP_LOG_DEBUG.toBoolean()  //删除这句即可
       }

        }

}

重新打包release 可以正常运行

上一篇:01-TCL-事务的理解


下一篇:tcp连接管理