# acc23x
**Repository Path**: zyf/acc23x
## Basic Information
- **Project Name**: acc23x
- **Description**: 用于构建安卓2.3.x的docker容器配置
- **Primary Language**: Docker
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-03-15
- **Last Updated**: 2022-05-30
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# acc23x
用于构建 android-2.3.x 的容器
## 构建容器
假设本机上构建容器的目标镜像名字为 *acc:23x*
1. 可以下载本项目后构建
```bash
git clone https://gitee.com/zyf/acc23x.git
cd acc23x
docker build -t acc:23x .
```
2. 也可以直接通过 git 仓库地址构建无需下载
```bash
docker build -t acc:23x https://gitee.com/zyf/acc23x.git
```
## 使用容器构建安卓
构建好了镜像就可以使用镜像构建安卓 2.3.x 的源码了
你需要自己下载好 android-2.3.x 的源码,例如放在了本机的 */tmp/aosp* 目录
```bash
docker run -it --rm -v /tmp/aosp:/aosp -w /aosp acc:23x bash
source build/envsetup.sh
lunch # 选择需要构建的目标
m -j $(getconf _NPROCESSORS_ONLN) # 使用所有的 cpu 核心来构建
```
这些指令会挂载 */tmp/aosp* 目录到容器内的 */aosp* 目录
然后进入容器后便可使用正常的构建安卓源码的流程构建了
## 使用模拟器测试构建结果(这个步骤可选)
### 构建容器
需要保证你已经构建了 acc:23x 这个名字的镜像。
因为该镜像依赖 acc:23x 这个镜像
```bash
docker build -t acc:23x-ui -f Dockerfile.ui https://gitee.com/zyf/acc23x.git
```
### 运行模拟器
*run_with_ui.sh* 可以在支持 xserver 的系统上方便的运行docker图形应用。
例如我用的 ubuntu 19.10 的桌面版本就可以
```bash
# 配置 IMG环境变量和 AOSP 环境变量然后运行脚本进入容器
env IMG=acc:23x-ui AOSP=/tmp/aosp;sh ./run_with_ui.sh
source build/envsetup.sh
lunch # 选择构建目标
emulator # 启动虚拟机
```