開始跟進(jìn)flutter項(xiàng)目
按照官方的文檔一步步接入:https://github.com/flutter/flutter/wiki/Add-Flutter-to-existing-apps
運(yùn)行demo,都沒有問題,一切正常
當(dāng)實(shí)際項(xiàng)目接入的時(shí)候坞靶,編譯跟安裝apk也正常酪穿,不過在打開flutter頁面的時(shí)候,報(bào)如下的錯(cuò)誤
[ERROR:flutter/runtime/dart_vm_data.cc(19)] VM snapshot invalid and could not be inferred from settings.
[ERROR:flutter/runtime/dart_vm.cc(241)] Could not setup VM data to bootstrap the VM from.
[ERROR:flutter/runtime/dart_vm_lifecycle.cc(89)] Could not create Dart VM instance.
[FATAL:flutter/shell/common/shell.cc(218)] Check failed: vm. Must be able to initialize the VM.
當(dāng)然在官方GitHub的issue下辫红,也有很多的討論凭涂,相關(guān)的方法也嘗試過,但是沒有生效
由于demo是正常的贴妻,項(xiàng)目是有異常切油,對(duì)比apk,發(fā)現(xiàn)項(xiàng)目的assets下缺少flutter_assets名惩,于是把demo的apk解壓,拿出里面的flutter_assets,放入項(xiàng)目中稚伍,運(yùn)行編譯戚宦,正常了
網(wǎng)絡(luò)上這種問題的解決方法太多了,很多都是無效的垦搬,故把自己的方法做個(gè)分享,供參考