MAC 下编译 ANDROID P 源码 提示 internal error: Could not find a supported mac sdk: ["10.10" "10.11" "10.12" "10.13"]

时间:2022-05-23 22:44:14

MAC 下编译 ANDROID P 源码出现下面的问题:

ninja: no work to do.
[21/21] out/soong/.bootstrap/bin/soong_build out/soong/build.ninja
FAILED: out/soong/build.ninja
out/soong/.bootstrap/bin/soong_build -t -l out/.module_paths/Android.bp.list -b out/soong -n out -d out/soong/build.ninja.d -o out/soong/build.ninja Android.bp
internal error: Could not find a supported mac sdk: ["10.10" "10.11" "10.12" "10.13"]
ninja: build stopped: subcommand failed.
15:14:37 soong bootstrap failed with: exit status 1 #### failed to build some targets (13 seconds) ####

  

解决方案:

cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
ls

MAC 下编译 ANDROID P 源码 提示  internal error: Could not find a supported mac sdk: ["10.10" "10.11" "10.12" "10.13"]

发现 SDK 为10.14,在 源码跟目录下查看 darwinSupportedSdkVersions 的定义,发现没有10.14,添加10.14即可

vim build/soong/cc/config/x86_darwin_host.go
          darwinSupportedSdkVersions = []string{
"10.10",
"10.11",
"10.12",
"10.13",
"10.14",
}

MAC 下编译 ANDROID P 源码 提示  internal error: Could not find a supported mac sdk: ["10.10" "10.11" "10.12" "10.13"]

然后再编译就好。

如果在/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/中没有SDK,可以在 https://github.com/phracker/MacOSX-SDKs/releases 下载

解压后copy 到 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/