随着Android大军的日益增多,从之前会敲HELLO WORLD就能找个不错的薪资,到现在不研究点源码都不好意思说你会Android,下面抛点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下载对应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....
解决方案:在对应目录下新建xt_DSCP.h文件(/Volumes/Android/source/external/iptables/include/linux/netfilter/):
ps:你会发现有同名文件,个人怀疑区分大小写的问题,导致找不到。
/* 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环境变量配置有问题
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
网友评论