Android源码编译

在编译源码之前需要做一些准备操作, 详细步骤如下:

1. 安装JDK, google官方要求编译2.3源码需要JDK1.6.

2. 安装其他编译时依赖的软件.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
sudo apt-get install gnupg
sudo apt-get install flex
sudo apt-get install bison
sudo apt-get install gperf
sudo apt-get install zip
sudo apt-get install curl
sudo apt-get install build-essential
sudo apt-get install libesd0-dev
sudo apt-get install libwxgtk2.8-dev
sudo apt-get install libsdl-dev
sudo apt-get install lsb-core
sudo apt-get install lib32readline-gplv2-dev
sudo apt-get install g++-multilib
sudo apt-get install lib32z1-dev
sudo apt-get install libswitch-perl

安装注意事项:

3. 开始编译, 在源码的目录下, 执行一下命令:

1
2
3
cd ~/android_source
make clean(如果之前有编译过,则需要调用这个命令)
make

注意: ubuntu自带的源中速度比较慢, 有些软件找不到, 所以需要修改为国内的源, 修改源步骤如下:

  • 1). 备份ubuntu自带的源.

    1
    sudo cp /etc/apt/sources.list /etc/apt/sources.list.old
  • 2). 修改源文件.

    1
    sudo gedit /etc/apt/sources.list
  • 3). 这时会弹出一个文本编辑框, 先删除所有内容, 然后把以下内容拷贝进去, 并保存.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
    deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
    deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
    deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
    deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse
    deb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
    deb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
    deb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
    deb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
    deb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse

    deb http://mirrors.sohu.com/ubuntu/ trusty main restricted universe multiverse
    deb http://mirrors.sohu.com/ubuntu/ trusty-security main restricted universe multiverse
    deb http://mirrors.sohu.com/ubuntu/ trusty-updates main restricted universe multiverse
    deb http://mirrors.sohu.com/ubuntu/ trusty-proposed main restricted universe multiverse
    deb http://mirrors.sohu.com/ubuntu/ trusty-backports main restricted universe multiverse
    deb-src http://mirrors.sohu.com/ubuntu/ trusty main restricted universe multiverse
    deb-src http://mirrors.sohu.com/ubuntu/ trusty-security main restricted universe multiverse
    deb-src http://mirrors.sohu.com/ubuntu/ trusty-updates main restricted universe multiverse
    deb-src http://mirrors.sohu.com/ubuntu/ trusty-proposed main restricted universe multiverse
    deb-src http://mirrors.sohu.com/ubuntu/ trusty-backports main restricted universe multiverse
  • 4). 保存之后, 更新数据源.

    1
    sudo apt-get update

本帖附件

点击下载

乱码三千 – 点滴积累 ,欢迎来到乱码三千技术博客站

0%