compile
- Install depot_tools and add it to the environment variable. Gclient comes from the depot_tools tool
- Fork the flutter engine code on Github. Configure SSH access to the flutter engine.
- Clone your own forked Flutter Engine code
- Create a. Gclient file in the engine directory with the following contents
solutions = [
{
"managed": False,
"name": "src/flutter"."url": "[email protected]:<your_name_here>/engine.git"."custom_deps": {},
"deps_file": "DEPS"."safesync_url": "",},]Copy the code
- Run gclient sync in the Engine directory. If ping chrome-infra-packages.appspot.com fails, suspend the proxy server and run the shell command
export http_proxy=http:/ / 127.0.0.1:1087;
export https_proxy=http:/ / 127.0.0.1:1087;
Copy the code
Gclient SYC again, the proxy port number needs to be modified according to the proxy tool you use, SS is 1087
- Switch source code. An important operation before compilation is to switch the source code to a commit point corresponding to the engine version (a commit ID) of the local Flutter SDK to avoid possible errors
# View the locally installed version of the Flutter SDK engine This file is contains the corresponding commit id vim SRC/flutter/bin/internal/engine version # adjust engine code CD/SRC/flutter git reset - hard the commit Id > gclient sync -d --with_branch_heads --with_tags # Ready to build file CD engine/ SRC # flutter1.12Use the following command to generate host_debug_unopt compilation configuration #./flutter/tools/gn -- run-time mode debug # flutter1.17Generate host_debug_unopt compilation configuration./flutter/tools/gn --unoptimized # Android arm (armeabi-v7a) compilation configuration./flutter/tools/gn -- Android --unoptimized # Android arm64 (armeabi-v8a) compiled configuration./flutter/tools/gn --android --unoptimized -- Runtime-mode =debug -- Android-cpu =arm64 ninja -c out/host_debug_unopt -j16
ninja -C out/android_debug_unopt -j 16Run ninja -C out/ android_debug_UNOpt_arm64-j16
Copy the code
run
Using a custom engine on the command line:
Create a Flutter project, Flutter create --org com.yourdomain your_app_name --local-engine-src-path <engine path>/src --local-engine=android_debug_unopt_arm64Copy the code
Parameter data
The compilation process is mainly referenced from
- Teach you to compile Flutter by hand
- Build, run and debug the Flutter engine