编译framework
https://github.com/flutter/engine/blob/master/CONTRIBUTING.md
编译release
debug
ninja -C out/ios_debug_unopt && ninja -C out/host_debug_unopt
release
$ ninja -C out/ios_release_unopt && ninja -C out/host_release_unopt
指定engine版本运行 flutter run
$../../bin/flutter run --local-engine-src-path /Users/boo/Documents/engine/engine/src/out/ios_debug --local-engine=ios_debug_unopt
$ flutter run --local-engine-src-path /Users/boo/Documents/engine/engine/src --local-engine=ios_debug_unopt
flutter packages get --local-engine-src-path /Users/boo/Documents/engine/engine/src --local-engine=ios_debug_sim_unopt -d XXXX
//运行flutter
$ flutter run --local-engine-src-path /Users/boo/Documents/engine/engine/src --local-engine=ios_debug_sim_unopt -d XXXX
修改完源代码添加runscript
image.pngcd /Users/boo/Documents/engine/engine/src
ninja -C out/ios_debug_unopt && ninja -C out/host_debug_unopt
cp -rf /Users/boo/Documents/engine/engine/src/out/ios_debug_unopt/Flutter.framework /Users/boo/Documents/demo/flutterbeta/flutterOnExistApp_SelfEngine/Flutter/engine
作用是重新编译framework使其生效
注意这里的debug,release,或模拟器目录要设正确,否则编译不过,下次生效
打开
设置xcode断点
image.pnginitWithFlutterAssets:dartMain:packages:
hellobooob
修改资源加载路径
修复循环引用
image.png image.png常见错误
image.pngUndefined symbols for architecture x86_64:
"_OBJC_CLASS_$_FlutterAppDelegate", referenced from:
_OBJC_CLASS_$_AppDelegate in AppDelegate.o
"_OBJC_CLASS_$_FlutterMethodChannel", referenced from:
objc-class-ref in libpackage_info.a(PackageInfoPlugin.o)
"_OBJC_METACLASS_$_FlutterAppDelegate", referenced from:
_OBJC_METACLASS_$_AppDelegate in AppDelegate.o
"_FlutterMethodNotImplemented", referenced from:
-[FLTPackageInfoPlugin handleMethodCall:result:] in libpackage_info.a(PackageInfoPlugin.o)
"_OBJC_CLASS_$_FlutterViewController", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
flutter.framework编译版本问题,需要重新编译或使用旧的替换先
[VERBOSE-1:callback_cache.cc(132)] Could not parse callback cache, aborting restore
2018-10-18 16:47:21.434650+0800 flutterOnExistApp[33371:13930425] [VERBOSE-2:shell.cc(181)] Dart Error: Can't load Kernel binary: Invalid kernel binary format version.
2018-10-18 16:47:21.434875+0800 flutterOnExistApp[33371:13930425] [VERBOSE-2:engine.cc(157)] Could not prepare to run the isolate.
2018-10-18 16:47:21.435723+0800 flutterOnExistApp[33371:13930425] [VERBOSE-2:engine.cc(116)] Engine not prepare and launch isolate.
2018-10-18 16:47:21.436000+0800 flutterOnExistApp[33371:13930425] [VERBOSE-2:FlutterViewController.mm(462)] Could not launch engine with configuration.
2018-10-18 16:47:21.554817+0800 flutterOnExistApp[33371:13930431] flutter: Observatory listening on http://127.0.0.1:54038/
还是flutter.framework 编译版本问
题
出现错误
You must specify --local-engine if you are using a locally built engine.
提示出错了,engin少了一个e 应该是engine
$ flutter packages get --local-engine=ios_debug_unopt
$ flutter run --local-engine=ios_debug_unopt
问题
image.pngUnable to detect local Flutter engine build directory.
Either specify a dependency_override for the sky_engine package in your pubspec.yaml and
ensure --package-root is set if necessary, or set the $FLUTTER_ENGINE environment variable, or
use --local-engine-src-path to specify the path to the root of your flutter/engine repository.
Failed to package /Users/boo/Documents/demo/flutterbeta/flutterOnExistApp_SelfEngine/myflutter.
Command /bin/sh failed with exit code 255
重新执行
pod update
其他不通过情况再尝试使用
flutter packages get
flutter run
问题:
2018-10-18 21:24:03.474221+0800 flutterOnExistApp[54577:15146469] [VERBOSE-2:shell.cc(182)] Dart Error: Can't load Kernel binary: Invalid kernel binary format version.
2018-10-18 21:24:03.474442+0800 flutterOnExistApp[54577:15146469] [VERBOSE-2:engine.cc(174)] Could not prepare to run the isolate.
2018-10-18 21:24:03.474760+0800 flutterOnExistApp[54577:15146469] [VERBOSE-2:engine.cc(121)] Engine not prepare and launch isolate.
2018-10-18 21:24:03.475266+0800 flutterOnExistApp[54577:15146469] [VERBOSE-2:FlutterViewController.mm(486)] Could not launch engine with configuration.
2018-10-18 21:24:03.522773+0800 flutterOnExistApp[54577:15146476] flutter: Observatory listening on http://127.0.0.1:56060/
flutter 和 engine版本不一致
需要更新到一致状态
使用命令
flutter upgrade
建了个qq群,大家有问题可以继续在里面讨论 217429001
网友评论