编译chromium autoninja -C out/Default system_webview_apk
出现错误
Traceback (most recent call last):
File "../../build/android/gyp/compile_java.py", line 747, in <module>
sys.exit(main(sys.argv[1:]))
File "../../build/android/gyp/compile_java.py", line 743, in main
output_paths=output_paths)
File "/home/nuodiehan/chromium-depot/chromium-latest/src/build/android/gyp/util/md5_check.py", line 64, in CallAndWriteDepfileIfStale
track_subpaths_allowlist=track_subpaths_allowlist)
File "/home/nuodiehan/chromium-depot/chromium-latest/src/build/android/gyp/util/md5_check.py", line 155, in CallAndRecordIfStale
function(*args)
File "../../build/android/gyp/compile_java.py", line 738, in <lambda>
lambda: _OnStaleMd5(options, javac_cmd, javac_args, java_files),
File "../../build/android/gyp/compile_java.py", line 415, in _OnStaleMd5
save_outputs=not options.enable_errorprone)
File "../../build/android/gyp/compile_java.py", line 512, in _RunCompiler
fail_on_output=options.warnings_as_errors)
File "/home/nuodiehan/chromium-depot/chromium-latest/src/build/android/gyp/util/build_utils.py", line 287, in CheckOutput
raise CalledProcessError(cwd, args, MSG.format(stream_string))
util.build_utils.CalledProcessError: Command failed: ( cd /home/nuodiehan/chromium-depot/chromium-latest/src/out/Default; ../../third_party/jdk/current/bin/javac -g -encoding UTF-8 -sourcepath : -source 1.8 -target 1.8 -proc:none -bootclasspath obj/third_party/android_sdk/android.ijar.jar:../../third_party/jdk/extras/java_8/jre/lib/rt.jar -d obj/media/base/android/display_java.javac.jar.staging/classes -classpath obj/third_party/android_deps/androidx_annotation_annotation.ijar.jar @obj/media/base/android/display_java.javac.jar.staging/files_list.txt )
Command failed because it wrote to stderr.
You can often set treat_warnings_as_errors=false to not treat output as failure (useful when developing locally).
[100/30872] ACTION //components/resour...d/toolchain/android:android_clang_x86)
ninja: build stopped: subcommand failed.
解决方案
在out/Default/args.gn 的编译文件中添加 fatal_linker_warnings=false
# Build arguments go here.
# See "gn args <out_dir> --list" for available build arguments.
target_os = "android"
target_cpu = "x86"
is_debug = false
system_webview_package_name = "com.android.webview"
fatal_linker_warnings = false
treat_warnings_as_errors=false
相关问题的链接:https://groups.google.com/a/chromium.org/g/chromium-dev/c/jnofouwbn0k/m/9lD-x-6LAgAJ
https://github.com/hanpfei/chromium-net/issues/1