隨著Android大軍的日益增多犬绒,從之前會(huì)敲HELLO WORLD就能找個(gè)不錯(cuò)的薪資驯妄,到現(xiàn)在不研究點(diǎn)源碼都不好意思說(shuō)你會(huì)Android诈胜,下面拋點(diǎn)Android源碼編譯的一些坑贼涩,os 10.12 ?Xcode 8.3 jdk 1.7/1.8
坑一:
Could not find a supported mac sdk: ["10.8" "10.9" "10.10" "10.11”]
解決方案:xcode版本不匹配引起的描睦。Xcode 8.3 sdk是10.12
1言缤,去https://github.com/phracker/MacOSX-SDKs下載對(duì)應(yīng)sdk版本嚼蚀,如10.11
2 將下載的sdk放在目錄/Applications/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/中
坑二:
out/target/product/generic/obj/STATIC_LIBRARIES/libext4_intermediates/libipt_ECN.o
Infile included fromout/target/product/generic/obj/STATIC_LIBRARIES/libext4_intermediates/libipt_ECN.c:11:0:
external/iptables/extensions/../include/linux/netfilter_ipv4/ipt_ECN.h:13:37: fatal error: linux/netfilter/xt_DSCP.h: No such fileordirectory#include ^
compilation terminated.make:*** [out/target/product/generic/obj/STATIC_LIBRARIES/libext4_intermediates/libipt_ECN.o] Error1make:*** Waiting for unfinished jobs....
解決方案:在對(duì)應(yīng)目錄下新建xt_DSCP.h文件(/Volumes/Android/source/external/iptables/include/linux/netfilter/):
ps:你會(huì)發(fā)現(xiàn)有同名文件,個(gè)人懷疑區(qū)分大小寫(xiě)的問(wèn)題管挟,導(dǎo)致找不到轿曙。
/* based on ipt_FTOS.c (C) 2000 by Matthew G. Marsh
* 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.7 2002/03/14 12:03:13 laforge Exp
*/#ifndef _XT_DSCP_TARGET_H#define _XT_DSCP_TARGET_H#include #include /* target info */structxt_DSCP_info {? ? ? ? __u8 dscp;};structxt_tos_target_info {? ? ? ? __u8 tos_value;? ? ? ? __u8 tos_mask;};#endif /* _XT_DSCP_TARGET_H */
坑三:
make: *** [out/host/common/obj/JAVA_LIBRARIES/doclava_intermediates/javalib.jar] Error 41
make: *** Waiting for unfinished jobs....
解決方案:jdk正常安裝的情況下,jdk環(huán)境變量配置有問(wèn)題
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar