前言
上章下完了代码, 这章来搞编译
编译坑是最多的, 坑 我统一放在后面了, 如果遇到问题,可以先看一下是否我这边已经有解决方法了.
开搞,开搞.
AOSP系列
开搞
自己的配置
硬件
Mac mini (Late 2014)
2.6 GHz i5
8G 1600 MHz DDR3
自己换了三星的500G固态硬盘
软件
系统版本: Mojave 10.14.4
源码
版本: android-6.0.1_r78
JDK 7
Python
verison: 2.7.10
Git
version 2.21.0
搭建环境
JDK
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上的文件系统不能区分大小写,所以需要创建区分大小写的镜像。
打开磁盘映像
然后点击空白映像, 配置如下, blog教程说至少70G, 我为了预防版本不同, 可能会包比较大问题, 直接分配100G了.
分配完成, 把源码移动到磁盘内
在这里插入图片描述
分配的时候真的挺卡的...
可能因为我电脑配置太垃圾问题, 20 ~ 30分钟才完成
虽然 blog 里面说, 先建磁盘, 但我个人建议, 先下载代码, 然后看代码有多大, 再去分.
不然分了磁盘, 再去磁盘里面下载, 但是你们版本不同, 包的大小也会不同
分配的盘装不下, 这种情况就很尴尬.
所以我就将这步放在了编译阶段.
编译
导入脚本环境
执行 envsetup.sh 脚本
. build/envsetup.sh
如果你再次编译, 需要清除已编译的数据, 可以调用以下命令
make clobber
权限问题
当时下载源码下来之后, 发现自己并没有操作权限
如果有童鞋也和我一样, 直接执行这个, 把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 的窗口执行, 在新的 shell 窗口执行 (个人估计是一些环境变量原因)
dalvik/CleanSpec.mk:47: *** missing separator.
后来编译完成之后, 发现新窗口的话, 编译,总是 generic 文件夹, 这个不应该的
想了一下, 肯定是用新窗口, 然后编译配置是用默认的了, 所以还是要解决这个方法
但是又找了好久, 没找到解决, 不过可以通过另一种思路去搞.
其实调用 lunch xxx 这个是配置加载数据的意思, 那么我们是否能把配置数据复制下来, 然后写到脚本内, 直接加载脚本呢, 达到直接配置的意思呢???
经过测试, 确实可以的
- 例如我把 aosp_x86_64 复制, 并创建一个 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
- 调用 make -j4 前, 导入配置
. 路径/xq_config_aosp_x86_64.sh
- 调用 make -j4
这个时候调用 make -j4 就能看到正常运行了, 并且能看到并不是只有 out/target/product/generic 了, 还创建了 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
再执行
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 还是会提示一大堆东西 ( 是默认优先去加载 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 放到环境内 ~/.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
设置版本
其实就是直接在当前命令窗口导入环境变量, 这个指标不治本, 后来自己再测了一下, 源码自己修改了 .bash_profile 文件, 但是没去导入它 (或者重新打开窗口), 这样环境变量就没有改变 =_=
export JAVA_HOME=`/usr/libexec/java_home -v 1.7.0_80`
再次, 查询, 很好, 当前环境变量已经调过来了, 然后继续执行 make -j4
java -version
bison
解决一
bison 有问题, 出现 Abort trap: 6
https://blog.csdn.net/camlot_/article/details/86540502
网站说的路径不太对, 最终自己找到的路径是 ==/opt/local/bin/bison== , 就是一开始配置环境 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 创建一个快捷方式到某个路径下
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
- 到该文件夹下
cd external/bison
- 创建 patch-high-sierra.patch
touch patch-high-sierra.patch
- 并把下面代码复制进去
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';
- 在控制台(保证当前目录是external/bison)执行 (这个是打补丁的意思??)
patch -p0 < patch-high-sierra.patch
- 返回源码根目录
cd ../..
- 编译 bison
make bison
- 复制编译好的 bison 到执行位置
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下面的这个来作为一个中转方法呢???
测试了一下, 是可以了!! (≧▽≦)/
大致就是做两步
- 下载 8.3.3 XCode
- 把 8.3.3 XCode 的 XcodeDefault.xctoolchain, 放到现在的 XCode 中, 记得, 不要删除原有的, 以后还要继续用XCode呢, 备份一下. 然后替换掉就行.
目前使用下来, 是没发现有什么问题
这段时间没有打开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 文件, 那么可以直接创建 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
根据提示, 执行
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.
参考文章
官网搭建编译环境
https://blog.csdn.net/yishon_android/article/details/51726676
https://blog.csdn.net/wd2014610/article/details/81636417
网友评论