Android 源碼 (AOSP) - 編譯 ( Mac )

前言

上章下完了代碼, 這章來搞編譯
編譯坑是最多的, 我統一放在后面了, 如果遇到問題雹锣,可以先看一下是否我這邊已經有解決方法了.

在這里插入圖片描述

開搞它改,開搞.

AOSP系列

開搞

自己的配置

硬件
Mac mini (Late 2014)
2.6 GHz i5
8G 1600 MHz DDR3
自己換了三星的500G固態(tài)硬盤

軟件
系統版本: Mojave 10.14.4

源碼
版本: android-6.0.1_r78

JDK 7

Python
verison: 2.7.10

Git
version 2.21.0

搭建環(huán)境

官網搭建編譯環(huán)境

JDK

下載地址
下載教程blog

android-6.0.1_r78 用的是 JDK 7

MacPorts

安裝了 MacPorts (看官網要求的遣妥, 也不知道不安裝會出現什么錯誤不, 當時沒試, 個人覺得不安裝, 應該也沒事, 比較官方的東西有點老)
通過 MacPorts 獲取 Make品姓、Git 和 GPG 程序包:

POSIXLY_CORRECT=1 sudo port install gmake libsdl git gnupg

安裝 bison:

POSIXLY_CORRECT=1 sudo port install bison

磁盤映像

因為Mac上的文件系統不能區(qū)分大小寫疆拘,所以需要創(chuàng)建區(qū)分大小寫的鏡像蜕猫。
打開磁盤映像
然后點擊空白映像, 配置如下, blog教程說至少70G, 我為了預防版本不同, 可能會包比較大問題, 直接分配100G了.
分配完成, 把源碼移動到磁盤內

在這里插入圖片描述

在這里插入圖片描述

分配的時候真的挺卡的...
可能因為我電腦配置太垃圾問題, 20 ~ 30分鐘才完成

雖然 blog 里面說, 先建磁盤, 但我個人建議, 先下載代碼, 然后看代碼有多大, 再去分.
不然分了磁盤, 再去磁盤里面下載, 但是你們版本不同, 包的大小也會不同
分配的盤裝不下, 這種情況就很尷尬.
所以我就將這步放在了編譯階段.

編譯

導入腳本環(huán)境

執(zhí)行 envsetup.sh 腳本

. build/envsetup.sh 

如果你再次編譯, 需要清除已編譯的數據, 可以調用以下命令

make clobber 

權限問題

當時下載源碼下來之后, 發(fā)現自己并沒有操作權限
如果有童鞋也和我一樣, 直接執(zhí)行這個, 把Android源碼這個文件夾改為所有人都可以讀寫

sudo chmod -R 777 源碼文件夾路徑

選擇要編譯的目標

命令行輸入

lunch

然后控制臺出現

Lunch menu... pick a combo:
     1. aosp_arm-eng
     2. aosp_arm64-eng
     3. aosp_mips-eng
     4. aosp_mips64-eng
     5. aosp_x86-eng
     6. aosp_x86_64-eng
     7. aosp_deb-userdebug
     8. aosp_flo-userdebug
     9. full_fugu-userdebug
     10. aosp_fugu-userdebug
     11. mini_emulator_arm64-userdebug
     12. m_e_arm-userdebug
     13. mini_emulator_mips-userdebug
     14. mini_emulator_x86-userdebug
     15. mini_emulator_x86_64-userdebug
     16. aosp_flounder-userdebug
     17. aosp_angler-userdebug
     18. aosp_bullhead-userdebug
     19. aosp_hammerhead-userdebug
     20. aosp_hammerhead_fp-userdebug
     21. aosp_shamu-userdebug

然后問你選擇哪一個, 直接輸入編號或者名稱都可以.
當然, 如果你已經知道編譯什么了, 也可以直接lunch帶上參數, 如下:

lunch aosp_arm-eng

開始編譯

開始編譯

-j4 是線程的意思, 并不是越多越好, 根據你機器cup的核心來確定: core * 2, 即當前cpu的核心的2倍, 是最快的速度.

make -j4

查看自己電腦的core

sysctl machdep.cpu

# 獲取到的信息
machdep.cpu.core_count: 2

那么我們就直接用 core * 2, 就是 make -j4

*** missing separator

不要在 . build/envsetup.sh 的窗口執(zhí)行, 在新的 shell 窗口執(zhí)行 (個人估計是一些環(huán)境變量原因)

dalvik/CleanSpec.mk:47: *** missing separator.

后來編譯完成之后, 發(fā)現新窗口的話, 編譯,總是 generic 文件夾, 這個不應該的
想了一下, 肯定是用新窗口, 然后編譯配置是用默認的了, 所以還是要解決這個方法
但是又找了好久, 沒找到解決, 不過可以通過另一種思路去搞.
其實調用 lunch xxx 這個是配置加載數據的意思, 那么我們是否能把配置數據復制下來, 然后寫到腳本內, 直接加載腳本呢, 達到直接配置的意思呢???
經過測試, 確實可以的

  1. 例如我把 aosp_x86_64 復制, 并創(chuàng)建一個 xq_config_aosp_x86_64.sh 文件, 然后寫入以下內容
#!/bin/bash

export PLATFORM_VERSION_CODENAME=REL
export PLATFORM_VERSION=6.0.1
export TARGET_PRODUCT=aosp_x86_64
export TARGET_BUILD_VARIANT=eng
export TARGET_BUILD_TYPE=release
export TARGET_BUILD_APPS=
export TARGET_ARCH=x86_64
export TARGET_ARCH_VARIANT=x86_64
export TARGET_CPU_VARIANT=
export TARGET_2ND_ARCH=x86
export TARGET_2ND_ARCH_VARIANT=x86
export TARGET_2ND_CPU_VARIANT=
export HOST_ARCH=x86_64
export HOST_OS=darwin
export HOST_OS_EXTRA=Darwin-18.5.0-x86_64-i386-64bit
export HOST_BUILD_TYPE=release
export BUILD_ID=MOB31S
export OUT_DIR=out

  1. 調用 make -j4 前, 導入配置
. 路徑/xq_config_aosp_x86_64.sh
  1. 調用 make -j4

這個時候調用 make -j4 就能看到正常運行了, 并且能看到并不是只有 out/target/product/generic 了, 還創(chuàng)建了 out/target/product/generic_x86_64 文件夾

make -j4

大約編譯了兩個小時, out 文件夾下 6.14 G (看電腦配置)

最后終于大功告成, 編譯完成!!! 以下是成功信息

Preparing output jar [/Volumes/android_source/android_source_back/out/target/common/obj/APPS/messaging_intermediates/proguard.classes.jar]
  Copying resources from program jar [/Volumes/android_source/android_source_back/out/target/common/obj/APPS/messaging_intermediates/classes.jar]
target Dex: messaging
Copying: out/target/common/obj/APPS/messaging_intermediates/classes.dex
target Package: messaging (out/target/product/generic/obj/APPS/messaging_intermediates/package.apk)
warning: string 'done' has no default translation.
warning: string 'done' is missing 90 required localizations: af_ZA am_ET ar_EG az_AZ bg_BG bn_BD ca_ES cs_CZ da_DK de_AT de_CH de_DE de_LI el_GR en_AU en_CA en_GB en_IN en_NZ en_SG en_US eo_EU es_ES es_US et_EE eu_ES fa_IR fi_FI fr_BE fr_CA fr_CH fr_FR gl_ES gu_IN hi_IN hr_HR hu_HU hy_AM in_ID is_IS it_CH it_IT iw_IL ja_JP ka_GE kk_KZ km_KH kn_IN ko_KR ky_KG lo_LA lt_LT lv_LV mk_MK ml_IN mn_MN mr_IN ms_MY my_MM nb_NO ne_NP nl_BE nl_NL pa_IN pl_PL pt_BR pt_PT rm_CH ro_RO ru_RU si_LK sk_SK sl_SI sq_AL sr_RS sv_SE sw_TZ ta_IN te_IN th_TH tl_PH tr_TR uk_UA ur_PK uz_UZ vi_VN zh_CN zh_HK zh_TW zu_ZA
Warning: AndroidManifest.xml already defines minSdkVersion (in http://schemas.android.com/apk/res/android); using existing value in manifest.
Warning: AndroidManifest.xml already defines targetSdkVersion (in http://schemas.android.com/apk/res/android); using existing value in manifest.
warning: no entries written for string/done (0x7f0e000d)
Install: out/target/product/generic/system/app/messaging/messaging.apk
Install: out/target/product/generic/system/priv-app/Settings/Settings.apk
build/tools/generate-notice-files.py  out/target/product/generic/obj/NOTICE.txt  out/target/product/generic/obj/NOTICE.html "Notices for files contained in the filesystem images in this directory:" out/target/product/generic/obj/NOTICE_FILES/src
Combining NOTICE files into HTML
Combining NOTICE files into text
Installed file list: out/target/product/generic/installed-files.txt
Target system fs image: out/target/product/generic/obj/PACKAGING/systemimage_intermediates/system.img
Running:  mkuserimg.sh out/target/product/generic/system out/target/product/generic/obj/PACKAGING/systemimage_intermediates/system.img ext4 system 1610612736 -D out/target/product/generic/system -L system out/target/product/generic/root/file_contexts
make_ext4fs -T -1 -S out/target/product/generic/root/file_contexts -L system -l 1610612736 -a system out/target/product/generic/obj/PACKAGING/systemimage_intermediates/system.img out/target/product/generic/system out/target/product/generic/system
Creating filesystem with parameters:
    Size: 1610612736
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 8192
    Inode size: 256
    Journal blocks: 6144
    Label: system
    Blocks: 393216
    Block groups: 12
    Reserved block group size: 95
Created filesystem with 1434/98304 inodes and 102834/393216 blocks
Install system fs image: out/target/product/generic/system.img
out/target/product/generic/system.img+ maxsize=1644333504 blocksize=2112 total=1610612736 reserve=16610880

-bash: lunch: command not found

先調用

. build/envsetup.sh

再執(zhí)行

lunch 

Can not find SDK

Can not find SDK 10.6 at /Developer/SDKs/MacOSX10.6.sdk

網上說法: 把 ==build/core/combo/mac_version.mk== 中的 ==mac_sdk_versions_supported== 版本問題, 只要修改一下, 對應你的 ==/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs== 下面 MacOSX 版本就行了.
但是我這邊試了并不行, 還是得屁顛屁顛跑去下載了低版本 SDKs.

然而下載 10.6 版本會出現下面這個問題

DVTSDK: Skipped SDK xxxx; its version (10.6) is below required minimum (10.11) for the macosx platform.

說最少得用 10.11 版本... 好吧, 下載 10.11 版本

DVTSDK: Skipped SDK /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk; its version (10.9) is below required minimum (10.11) for the macosx platform.

如果你 SDKs 里面有 10.6 還是會提示一大堆東西 ( 是默認優(yōu)先去加載 10.6 了??? ), 這個時候, 只要把10.6 移除就行了.

JDK

Unable to find any JVMs

該問題是找不到java版本

Unable to find any JVMs matching version "1.7". 

可以先 open /Library/Java/JavaVirtualMachines/
看一下你本機是否有JDK了, 如果沒有或者版本比Android源碼要求的高, 都去下載, 然后把該 openjdk/Contents/Home 放到環(huán)境內 ~/.bash_profile

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home
export ANDROID_JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home

tools.jar

找不到 tools.jar, 因為一開始我用的是 12.0.1 版本, 在 JDK9 的時候, 官方就移除了 tools.jar
所以我們要下載 JDK8, 然后把相對應的 tools.jar 移過來就行 然而經自己測試了一下, 還是有問題, 所以不要搞啥花里胡哨的, 直接下載 JDK 7 (源碼對應JDK)

Error: could not find jdk tools.jar

The required version is: "1.7.x"

JDK 還是報錯說不要用 12.0.1 版本, 這個下載 JDK 7 就行了

You are attempting to build with the incorrect version
of java.
 
Your version is: openjdk version "12.0.1" 2019-04-16 OpenJDK Runtime Environment (build 12.0.1+12) OpenJDK 64-Bit Server VM (build 12.0.1+12, mixed mode, sharing).
The required version is: "1.7.x"
 
Please follow the machine setup instructions at
    https://source.android.com/source/initializing.html

下載之后, 設置 ~/.bash_profile

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home
export ANDROID_JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home

但是我碰到了, 設置還是不行
然后先查詢現在的版本

/usr/libexec/java_home -V

設置版本
其實就是直接在當前命令窗口導入環(huán)境變量, 這個指標不治本, 后來自己再測了一下, 源碼自己修改了 .bash_profile 文件, 但是沒去導入它 (或者重新打開窗口), 這樣環(huán)境變量就沒有改變 =_=

export JAVA_HOME=`/usr/libexec/java_home -v 1.7.0_80`

再次, 查詢, 很好, 當前環(huán)境變量已經調過來了, 然后繼續(xù)執(zhí)行 make -j4

java -version

bison

解決一

bison 有問題, 出現 Abort trap: 6
https://blog.csdn.net/camlot_/article/details/86540502
網站說的路徑不太對, 最終自己找到的路徑是 ==/opt/local/bin/bison== , 就是一開始配置環(huán)境 Macports 下載的時候, 會下到這個路徑下
然而如果自己用 brew install Bison 就是在這個路徑下 /usr/local/Cellar/bison/版本/bin/bison

prebuilts/misc/darwin-x86/bison/bison -d  -o out/host/darwin-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp frameworks/base/tools/aidl/aidl_language_y.y
make: *** [out/host/darwin-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp] Abort trap: 6
make: *** Waiting for unfinished jobs....
注: 某些輸入文件使用了未經檢查或不安全的操作哎迄。
注: 有關詳細信息, 請使用 -Xlint:unchecked 重新編譯丹锹。
注: 某些輸入文件使用了未經檢查或不安全的操作。
注: 有關詳細信息, 請使用 -Xlint:unchecked 重新編譯芬失。

把 bison 創(chuàng)建一個快捷方式到某個路徑下

ln -s 源文件路徑 目標路徑

解決二

編譯 8.0 的時候查出來的

FAILED: out/soong/.intermediates/system/tools/aidl/libaidl-common/darwin_x86_64_static/gen/yacc/system/tools/aidl/aidl_language_y.cpp out/soong/.intermediates/system/tools/aidl/libaidl-common/darwin_x86_64_static/gen/yacc/system/tools/aidl/aidl_language_y.h 
BISON_PKGDATADIR=external/bison/data prebuilts/misc/darwin-x86/bison/bison -d  --defines=out/soong/.intermediates/system/tools/aidl/libaidl-common/darwin_x86_64_static/gen/yacc/system/tools/aidl/aidl_language_y.h -o out/soong/.intermediates/system/tools/aidl/libaidl-common/darwin_x86_64_static/gen/yacc/system/tools/aidl/aidl_language_y.cpp system/tools/aidl/aidl_language_y.yy
[  1% 971/59651] cc out/soong/.intermediates/system/...armv7-a_static_core/obj/system/core/adf/libadf/adf.
ninja: build stopped: subcommand failed.
11:00:22 ninja failed with: exit status 1
make: *** [run_soong_ui] Error 1

網上說到這個目錄下, 然后更新指定 git 版本, 但是我這邊根本更不了... .git 文件夾就是壞的

cd external/bison
git cherry-pick c0c852bd6fe462b148475476d9124fd740eba160

上面說的copy一個bison到這個文件夾, 也是不行的....
后面找到了這個, 自己去編譯一個 bison 出來 (上面的 git cherry-pick 就是打補丁, 而這個是手動打補丁)
https://blog.csdn.net/h649305597/article/details/80322488

  1. 到該文件夾下
cd external/bison
  1. 創(chuàng)建 patch-high-sierra.patch
touch patch-high-sierra.patch
  1. 并把下面代碼復制進去
With format string strictness, High Sierra also enforces that %n isn't used
in dynamic format strings, but we should just disable its use on darwin in
general.

--- lib/vasnprintf.c.orig   2017-06-22 15:19:15.000000000 -0700
+++ lib/vasnprintf.c    2017-06-22 15:20:20.000000000 -0700
@@ -4869,7 +4869,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *
 #endif
                   *fbp = dp->conversion;
 #if USE_SNPRINTF
-# if !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
+# if !defined(__APPLE__) && !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
                 fbp[1] = '%';
                 fbp[2] = 'n';
                 fbp[3] = '\0';
  1. 在控制臺(保證當前目錄是external/bison)執(zhí)行 (這個是打補丁的意思??)
patch -p0 < patch-high-sierra.patch
  1. 返回源碼根目錄
cd ../..
  1. 編譯 bison
make bison
  1. 復制編譯好的 bison 到執(zhí)行位置
cp ./out/host/darwin-x86/obj/EXECUTABLES/bison_intermediates/bison ./prebuilts/misc/darwin-x86/bison/bison 

XcodeDefault.xctoolchain

external/libcxx/include/cstdlib:159:44: error: declaration conflicts with target of using declaration already in scope
inline _LIBCPP_INLINE_VISIBILITY long      abs(     long __x) _NOEXCEPT {return  labs(__x);}
                                           ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdlib.h:111:44: note: target of using declaration
inline _LIBCPP_INLINE_VISIBILITY long      abs(     long __x) _NOEXCEPT {return  labs(__x);}
                                           ^
external/libcxx/include/cstdlib:134:9: note: using declaration
using ::abs;
        ^
external/libcxx/include/cstdlib:161:44: error: declaration conflicts with target of using declaration already in scope
inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
                                           ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdlib.h:113:44: note: target of using declaration
inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
                                           ^
external/libcxx/include/cstdlib:134:9: note: using declaration
using ::abs;
        ^
external/libcxx/include/cstdlib:164:42: error: declaration conflicts with target of using declaration already in scope
inline _LIBCPP_INLINE_VISIBILITY  ldiv_t div(     long __x,      long __y) _NOEXCEPT {return  ldiv(__x, __y);}
                                         ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdlib.h:116:42: note: target of using declaration
inline _LIBCPP_INLINE_VISIBILITY  ldiv_t div(     long __x,      long __y) _NOEXCEPT {return  ldiv(__x, __y);}
                                         ^
external/libcxx/include/cstdlib:139:9: note: using declaration
using ::div;
        ^
external/libcxx/include/cstdlib:166:42: error: declaration conflicts with target of using declaration already in scope
inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) _NOEXCEPT {return lldiv(__x, __y);}
                                         ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdlib.h:118:42: note: target of using declaration
inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) _NOEXCEPT {return lldiv(__x, __y);}

20 errors generated.
make: *** [out/host/darwin-x86/obj/STATIC_LIBRARIES/libc++_static_intermediates/src/algorithm.o] Error 1
4 errors generated.
make: *** [out/host/darwin-x86/obj/STATIC_LIBRARIES/libc++_static_intermediates/src/ios.o] Error 1

查了一下, 說需要換低版本XCode
下載 XCode 8.3.3, 好吧, 又是一陣等待
下載好之后, 選中 Xcode_8.3.3 為默認

sudo xcode-select -switch /Applications/Xcode_8.3.3.app/Contents/Developer

再次 make -j4

dyld: Symbol not found: _OBJC_IVAR_$_NSTextViewIvars.sharedData
  Referenced from: /Applications/Xcode_8_3_3.app/Contents/SharedFrameworks/DVTDocumentation.framework/Versions/A/../../../../SharedFrameworks/DVTKit.framework/Versions/A/DVTKit
  Expected in: /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
 in /Applications/Xcode_8_3_3.app/Contents/SharedFrameworks/DVTDocumentation.framework/Versions/A/../../../../SharedFrameworks/DVTKit.framework/Versions/A/DVTKit
make: error: unable to locate xcodebuild, please make sure the path to the Xcode folder is set correctly!
make: error: You can set the path to the Xcode folder using /usr/bin/xcode-select -switch

然而....又報錯, 說不支持, 查了一下, 說 Mojave 不支持 10.0 以下的 XCode... oh my god! 很崩潰! 退版本這個是不存在的...
好吧, 有點絕望, 各種踩坑, 這個是弄了最久的, 網上各種資料, 都無法解決.

后來再自己仔細研究了一下, 其實這些報錯, 是指向 XcodeDefault.xctoolchain

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdlib.h:118:42

那么是否能通過不替換XCode, 而是替換XCode下面的這個來作為一個中轉方法呢???
測試了一下, 是可以了!! (≧▽≦)/

大致就是做兩步

  1. 下載 8.3.3 XCode
  2. 把 8.3.3 XCode 的 XcodeDefault.xctoolchain, 放到現在的 XCode 中, 記得, 不要刪除原有的, 以后還要繼續(xù)用XCode呢, 備份一下. 然后替換掉就行.
在這里插入圖片描述

目前使用下來, 是沒發(fā)現有什么問題
這段時間沒有打開XCode過, 不知道會影響 XCode 什么問題, 建議打開XCode 之前, 先把這個改回來.

xt_DSCP.h

找不到 xt_DSCP.h 文件

external/iptables/extensions/../include/linux/netfilter_ipv4/ipt_ECN.h:13:37: fatal error: linux/netfilter/xt_DSCP.h: No such file or directory
 #include <linux/netfilter/xt_DSCP.h>
                                     ^
compilation terminated.

修改 external/iptables/include/linux/netfilter_ipv4/ipt_ECN.h 文件

#include <linux/netfilter/xt_DSCP.h>

改成

#include <linux/netfilter/xt_dscp.h>

如果你 linux/netfilter 沒有 xt_dscp.h 文件, 那么可以直接創(chuàng)建 xt_DSCP.h

/* x_tables module for matching the IPv4/IPv6 DSCP field
 *
 * (C) 2002 Harald Welte <laforge@gnumonks.org>
 * This software is distributed under GNU GPL v2, 1991
 *
 * See RFC2474 for a description of the DSCP field within the IP Header.
 *
 * xt_dscp.h,v 1.3 2002/08/05 19:00:21 laforge Exp
*/
#ifndef _XT_DSCP_H
#define _XT_DSCP_H

#include <linux/types.h>

#define XT_DSCP_MASK    0xfc    /* 11111100 */
#define XT_DSCP_SHIFT   2
#define XT_DSCP_MAX 0x3f    /* 00111111 */

/* match info */
struct xt_dscp_info {
    __u8 dscp;
    __u8 invert;
};

struct xt_tos_match_info {
    __u8 tos_mask;
    __u8 tos_value;
    __u8 invert;
};

#endif /* _XT_DSCP_H */

make update-api

******************************
You have tried to change the API from what has been previously approved.

To make these errors go away, you have two choices:
   1) You can add "@hide" javadoc comments to the methods, etc. listed in the
      errors above.

   2) You can update current.txt by executing the following command:
         make update-api

      To submit the revised current.txt to the main Android repository,
      you will need approval.
******************************



make: *** [out/target/common/obj/PACKAGING/checksystemapi-current-timestamp] Error 38

******************************
You have tried to change the API from what has been previously released in
an SDK.  Please fix the errors listed above.
******************************


make: *** [out/target/common/obj/PACKAGING/checksystemapi-last-timestamp] Error 38

根據提示, 執(zhí)行

make update-api

其他

bash_profile 配置

bash_profile配置, 這里就列一下我的配置吧

[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

# wxq Android NDK
#export NDK_HOME=~/android-ndk-r11c
export NDK_HOME=~/Library/Android/sdk/ndk-bundle
export NDK_PROJECT_PATH='/Applications/Android\ Studio.app'
export ANDROID_SDK_ROOT=~/Library/Android/sdk
export PATH=$PATH:$NDK_HOME/
export PATH=$PATH:$ANDROID_SDK_ROOT

# wxq Android 6
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home
export ANDROID_JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home


# wxq Android源碼編譯, 在 Mac OS 中,可同時打開的文件描述符的默認數量上限太低匾灶,在高度并行的編譯流程中棱烂,可能會超出此上限。要提高此上限
# set the number of open files to be 1024
ulimit -S -n 1024

# 這個是下載 MacPorts 自動配置上去的
##
# Your previous /Users/wangxingqian/.bash_profile file was backed up as /Users/wangxingqian/.bash_profile.macports-saved_2019-05-20_at_11:34:23
##

# MacPorts Installer addition on 2019-05-20_at_11:34:23: adding an appropriate PATH variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
# Finished adapting your PATH environment variable for use with MacPorts.

參考文章

官網搭建編譯環(huán)境
https://blog.csdn.net/yishon_android/article/details/51726676
https://blog.csdn.net/wd2014610/article/details/81636417

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
  • 序言:七十年代末阶女,一起剝皮案震驚了整個濱河市颊糜,隨后出現的幾起案子,更是在濱河造成了極大的恐慌秃踩,老刑警劉巖衬鱼,帶你破解...
    沈念sama閱讀 219,270評論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現場離奇詭異鸟赫,居然都是意外死亡消别,警方通過查閱死者的電腦和手機寻狂,發(fā)現死者居然都...
    沈念sama閱讀 93,489評論 3 395
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來缀壤,“玉大人塘慕,你說我怎么就攤上這事蒂胞∑√埽” “怎么了拥娄?”我有些...
    開封第一講書人閱讀 165,630評論 0 356
  • 文/不壞的土叔 我叫張陵稚瘾,是天一觀的道長摊欠。 經常有香客問我柱宦,道長,這世上最難降的妖魔是什么掸刊? 我笑而不...
    開封第一講書人閱讀 58,906評論 1 295
  • 正文 為了忘掉前任忧侧,我火速辦了婚禮,結果婚禮上蚓炬,老公的妹妹穿的比我還像新娘肯夏。我一直安慰自己,他們只是感情好烛恤,可當我...
    茶點故事閱讀 67,928評論 6 392
  • 文/花漫 我一把揭開白布缚柏。 她就那樣靜靜地躺著碟贾,像睡著了一般袱耽。 火紅的嫁衣襯著肌膚如雪朱巨。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,718評論 1 305
  • 那天琼讽,我揣著相機與錄音钻蹬,去河邊找鬼吼蚁。 笑死肝匆,一個胖子當著我的面吹牛旗国,可吹牛的內容都是我干的注整。 我是一名探鬼主播,決...
    沈念sama閱讀 40,442評論 3 420
  • 文/蒼蘭香墨 我猛地睜開眼设捐,長吁一口氣:“原來是場噩夢啊……” “哼塘淑!你這毒婦竟也來了萝招?” 一聲冷哼從身側響起,我...
    開封第一講書人閱讀 39,345評論 0 276
  • 序言:老撾萬榮一對情侶失蹤槐沼,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后捌治,有當地人在樹林里發(fā)現了一具尸體岗钩,經...
    沈念sama閱讀 45,802評論 1 317
  • 正文 獨居荒郊野嶺守林人離奇死亡肖油,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 37,984評論 3 337
  • 正文 我和宋清朗相戀三年兼吓,在試婚紗的時候發(fā)現自己被綠了。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片森枪。...
    茶點故事閱讀 40,117評論 1 351
  • 序言:一個原本活蹦亂跳的男人離奇死亡视搏,死狀恐怖县袱,靈堂內的尸體忽然破棺而出浑娜,到底是詐尸還是另有隱情筋遭,我是刑警寧澤漓滔,帶...
    沈念sama閱讀 35,810評論 5 346
  • 正文 年R本政府宣布,位于F島的核電站次和,受9級特大地震影響石蔗,放射性物質發(fā)生泄漏。R本人自食惡果不足惜畅形,卻給世界環(huán)境...
    茶點故事閱讀 41,462評論 3 331
  • 文/蒙蒙 一养距、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧日熬,春花似錦棍厌、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,011評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至毕荐,卻和暖如春束析,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背憎亚。 一陣腳步聲響...
    開封第一講書人閱讀 33,139評論 1 272
  • 我被黑心中介騙來泰國打工员寇, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人第美。 一個月前我還...
    沈念sama閱讀 48,377評論 3 373
  • 正文 我出身青樓蝶锋,卻偏偏與公主長得像,于是被迫代替她去往敵國和親什往。 傳聞我的和親對象是個殘疾皇子扳缕,可洞房花燭夜當晚...
    茶點故事閱讀 45,060評論 2 355