Android12 编译环境搭建

1. 准备台电脑,编译 Android 对机器要很高,推荐标准配置,避免机器某个导致 Android 编译失败。

最低配置:
• 64 位处理器 16 线程
• 64 位物理内存 16GB(16GB只能使用1线程编译, 2线程或多线程编译会导致内存溢出而编译失败)
• 硬盘 263GB 空闲的磁盘空间

标准配置:
• 64 位处理器 32 线程
• 64 位物理内存 32GB
• 固态硬盘 1TB 空闲的磁盘空间
• 系统:使用 Ubuntu 20.04 操作系统或更高版本

2. 安装依赖。每个人电脑安装软件包不一样,环境搭建也不一样,我们根据 Ubuntu20.04 去安装依赖

使用 lsb_release -a 查看ubuntu 系统版本:

digipro@P510:~$ lsb_release -a
LSB Version:    core-11.1.0ubuntu2-noarch:security-11.1.0ubuntu2-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.6 LTS
Release:        20.04
Codename:       focal

安装改依赖

sudo apt-get update
sudo apt-get install -y openjdk-8-jdk git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libgl1-mesa-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev libncurses5 libssl-dev libxml2-utils xsltproc unzip python2 bc imagemagick ccache schedtool libncurses* clang

可能有部分会出错, 例如 Depends: libcurl4 (= 7.68.0-1ubuntu2.20) but 7.68.0-1ubuntu2.19 is to be installed 等等, 我这边就遇到如下问题, 可先忽略。

Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'git' instead of 'git-core'
Note, selecting 'lib32ncurses-dev' instead of 'lib32ncurses5-dev'
Note, selecting 'lib32z1-dev' instead of 'lib32z-dev'
Note, selecting 'libncursesw5-dbg' for glob 'libncurses*'
Note, selecting 'libncursesw5-dev' for glob 'libncurses*'
Note, selecting 'libncurses5' for glob 'libncurses*'
Note, selecting 'libncurses6' for glob 'libncurses*'
Note, selecting 'libncursesw5' for glob 'libncurses*'
Note, selecting 'libncursesw6' for glob 'libncurses*'
Note, selecting 'libncursesada7-dev' for glob 'libncurses*'
Note, selecting 'libncurses5-dbg' for glob 'libncurses*'
Note, selecting 'libncurses5-dev' for glob 'libncurses*'
Note, selecting 'libncursesada-doc' for glob 'libncurses*'
Note, selecting 'libncurses-dev' for glob 'libncurses*'
Note, selecting 'libncursesada6.2.20180127.1' for glob 'libncurses*'
Note, selecting 'libncurses-gst' for glob 'libncurses*'
bc is already the newest version (1.07.1-2build1).
bison is already the newest version (2:3.5.1+dfsg-1).
flex is already the newest version (2.6.4-6.2).
g++-multilib is already the newest version (4:9.3.0-1ubuntu2).
gcc-multilib is already the newest version (4:9.3.0-1ubuntu2).
gcc-multilib set to manually installed.
x11proto-core-dev is already the newest version (2019.2-1ubuntu1).
x11proto-core-dev set to manually installed.
zip is already the newest version (3.0-11build1).
clang is already the newest version (1:10.0-50~exp1).
gperf is already the newest version (3.1-1build1).
python2 is already the newest version (2.7.17-2ubuntu4).
python2 set to manually installed.
build-essential is already the newest version (12.8ubuntu1.1).
git is already the newest version (1:2.25.1-1ubuntu3.11).
gnupg is already the newest version (2.2.19-3ubuntu2.2).
libgl1-mesa-dev is already the newest version (21.2.6-0ubuntu0.1~20.04.2).
libgl1-mesa-dev set to manually installed.
libncurses-dev is already the newest version (6.2-0ubuntu2.1).
libncurses-dev set to manually installed.
libncurses5-dev is already the newest version (6.2-0ubuntu2.1).
libncurses5-dev set to manually installed.
libncurses6 is already the newest version (6.2-0ubuntu2.1).
libncurses6 set to manually installed.
libncursesw6 is already the newest version (6.2-0ubuntu2.1).
libncursesw6 set to manually installed.
libssl-dev is already the newest version (1.1.1f-1ubuntu2.19).
libxml2-utils is already the newest version (2.9.10+dfsg-5ubuntu0.20.04.6).
unzip is already the newest version (6.0-25ubuntu1.1).
zlib1g-dev is already the newest version (1:1.2.11.dfsg-2ubuntu1.5).
imagemagick is already the newest version (8:6.9.10.23+dfsg-2.1ubuntu11.9).
libncurses5 is already the newest version (6.2-0ubuntu2.1).
libncursesw5 is already the newest version (6.2-0ubuntu2.1).
openjdk-8-jdk is already the newest version (8u382-ga-1~20.04.1).
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 curl : Depends: libcurl4 (= 7.68.0-1ubuntu2.20) but 7.68.0-1ubuntu2.19 is to be installed
 lib32ncurses-dev : Depends: lib32ncurses6 (= 6.2-0ubuntu2.1) but it is not going to be installed
                    Depends: lib32ncursesw6 (= 6.2-0ubuntu2.1) but it is not going to be installed
                    Depends: lib32tinfo6 (
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值