当前位置: 代码迷 >> Android >> 怎么编译android4(Ubuntu11.10)
  详细解决方案

怎么编译android4(Ubuntu11.10)

热度:179   发布时间:2016-05-01 14:19:24.0
如何编译android4(Ubuntu11.10)
完全是一个全新的系统,如何编译android4.0?其实很简单。
1. 访问地址http://source.android.com/source/initializing.html
2. 按照指示安装一些工具:
$ sudo apt-get install libx11-dev:i386
   JDK:
$ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
$ sudo apt-get update
$ sudo apt-get install sun-java6-jdk
   Python:
$ sudo apt-get install python
   Git
$ sudo apt-get install git
   Curl
$ sudo apt-get install curl
   g++
$ sudo apt-get install g++
   zlib
$ sudo apt-get install zlib1g-dev
$ sudo apt-get install lib64z1-dev
   bison
$ sudo apt-get install bison
   flex
$ sudo apt-get install flex
   ncurses
$ sudo apt-get install libncurses5-dev
   GL
$ sudo apt-get install libgl1-mesa-dev
   gpref
$ sudo apt-get install gpref

3. http://source.android.com/source/downloading.html
$ mkdir ~/bin
$ PATH=~/bin:$PATH

$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo

$ mkdir WORKING_DIRECTORY
$ cd WORKING_DIRECTORY

$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1
$ repo sync

4. build/core/config.mk
去掉Werror这行(目的是不要把warnings当成errors)

5.
修改 gedit frameworks/base/libs/utils/Android.mk
将:
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)
改为:
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) -fpermissive

6.
修改文件
external/oprofile/libpp/Android.mk
external/oprofile/pp/Android.mk

LOCAL_CFLAGS := $(common_host_cflags)
改为
LOCAL_CFLAGS := $(common_host_cflags) -fpermissive

7.
修改make文件
frameworks/base/tools/aapt/Android.mk
frameworks/base/tools/localize/Android.mk
将这几句
ifeq ($(HOST_OS),linux)
LOCAL_LDLIBS += -lrt
endif
改为
ifeq ($(HOST_OS),linux)
LOCAL_LDLIBS += -lrt -lpthread
endif

8.
修改源码目录下/build/core/combo/HOST_linux-x86.mk文件:
将以下语句
HOST_GLOBAL_CFLAGS += -D_FORTIFY_SOURCE=0
修改为
HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0

9.
$vi external/gtest/src/../include/gtest/internal/gtest-param-util.h
+ #include <cstddef>

10. http://source.android.com/source/building.html
$ source build/envsetup.sh
$ lunch full-eng
$ make -j4
  相关解决方案