Ubuntu12.04编译Android2.3.4
Ubuntu12.04编译Android2.3.4
1.下载Ubuntu
ubuntu-12.04-dvd-i386.iso
2.使用U盘安装,启动盘制作用unetbootin-windows-568工具即可
3.虚拟机用的是VMware-workstation-full-8.0.2-591240.exe破解版本,或者直接安装在机器上
4.虚拟机安装vmware tools
打开虚拟机,点击install vmware tools
把 vmware tools拖到桌面上(命令复制时由于有空格 需要添加双引号“”),ctrl+alt+t进入终端,输入sudo su 输入密码获取root权限,然后把vmware tools CP到/tmp中tar vzxf vmwaretools解压后到 vmware-tools-distrib里面输入./vmware-install.pl安装,根据提示到出现enjoy,--the vmware team就成功安装了。
可以通过在终端中输入如下命令来运行它:
$ /usr/bin/vmware-toolbox
或者让vmware-toolbox实现开机自动运行。
点击Ubuntu菜单:System——首选项——会话—— Startup Programs,Add一个Name叫“vmware-toolbox”,Command是“/usr/bin/vmware-toolbox”的启动程序。这样每次开机后就能自动运行VMware Tools了
5.更新源
sudo cp /etc/apt/sources.list /etc/apt/sources.list_back (这是备份源列表)
sudo gedit /etc/apt/sources.list (这是编辑源列表)
sudo cp /etc/apt/sources.list_backup /etc/apt/sources_list(恢复源列表)
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install ubuntu-restricted-extras
一些常用的源列表:
deb http://cn.archive.Ubuntu.com/ubuntu/ natty multiverse
deb-src http://cn.archive.Ubuntu.com/ubuntu/ natty multiverse
deb http://cn.archive.Ubuntu.com/ubuntu/ natty-updates multiverse
deb-src http://cn.archive.Ubuntu.com/ubuntu/ natty-updates multiverse
deb http://security.Ubuntu.com/ubuntu natty-security main restricted
deb-src http://security.Ubuntu.com/ubuntu natty-security main restricted
deb http://security.Ubuntu.com/ubuntu natty-security universe
deb-src http://security.Ubuntu.com/ubuntu natty-security universe
deb http://security.Ubuntu.com/ubuntu natty-security multiverse
deb-src http://security.Ubuntu.com/ubuntu natty-security multiverse
deb http://archive.canonical.com/Ubuntu natty partner
deb-src http://archive.canonical.com/Ubuntu natty partner
台湾源
deb http://tw.archive.Ubuntu.com/ubuntu/ natty main universe restricted multiverse
deb-src http://tw.archive.Ubuntu.com/ubuntu/ natty main universe restricted multiverse
deb http://tw.archive.Ubuntu.com/ubuntu/ natty-security universe main multiverse restricted
deb-src http://tw.archive.Ubuntu.com/ubuntu/ natty-security universe main multiverse restricted
deb http://tw.archive.Ubuntu.com/ubuntu/ natty-updates universe main multiverse restricted
deb-src http://tw.archive.Ubuntu.com/ubuntu/ natty-updates universe main multiverse restricted
网易源(速度很快)
deb http://mirrors.163.com/Ubuntu/ natty main universe restricted multiverse
deb-src http://mirrors.163.com/Ubuntu/ natty main universe restricted multiverse
deb http://mirrors.163.com/Ubuntu/ natty-security universe main multiverse restricted
deb-src http://mirrors.163.com/Ubuntu/ natty-security universe main multiverse restricted
deb http://mirrors.163.com/Ubuntu/ natty-updates universe main multiverse restricted
deb http://mirrors.163.com/Ubuntu/ natty-proposed universe main multiverse restricted
deb-src http://mirrors.163.com/Ubuntu/ natty-proposed universe main multiverse restricted
deb http://mirrors.163.com/Ubuntu/ natty-backports universe main multiverse restricted
deb-src http://mirrors.163.com/Ubuntu/ natty-backports universe main multiverse restricted
deb-src http://mirrors.163.com/Ubuntu/ natty-updates universe main multiverse restricted
上海源
deb http://mirror.rootguide.org/Ubuntu/ natty main universe restricted multiverse
deb-src http://mirror.rootguide.org/Ubuntu/ natty main universe restricted multiverse
deb http://mirror.rootguide.org/Ubuntu/ natty-security universe main multiverse restricted
deb-src http://mirror.rootguide.org/Ubuntu/ natty-security universe main multiverse restricted
deb http://mirror.rootguide.org/Ubuntu/ natty-updates universe main multiverse restricted
deb http://mirror.rootguide.org/Ubuntu/ natty-proposed universe main multiverse restricted
deb-src http://mirror.rootguide.org/Ubuntu/ natty-proposed universe main multiverse restricted
deb http://mirror.rootguide.org/Ubuntu/ natty-backports universe main multiverse restricted
deb-src http://mirror.rootguide.org/Ubuntu/ natty-backports universe main multiverse restricted
deb-src http://mirror.rootguide.org/Ubuntu/ natty-updates universe main multiverse restricted
搜狐源
deb http://mirrors.shlug.org/Ubuntu/ natty main universe restricted multiverse
deb-src http://mirrors.shlug.org/Ubuntu/ natty main universe restricted multiverse
deb http://mirrors.shlug.org/Ubuntu/ natty-security universe main multiverse restricted
deb-src http://mirrors.shlug.org/Ubuntu/ natty-security universe main multiverse restricted
deb http://mirrors.shlug.org/Ubuntu/ natty-updates universe main multiverse restricted
deb http://mirrors.shlug.org/Ubuntu/ natty-proposed universe main multiverse restricted
deb-src http://mirrors.shlug.org/Ubuntu/ natty-proposed universe main multiverse restricted
deb http://mirrors.shlug.org/Ubuntu/ natty-backports universe main multiverse restricted
deb-src http://mirrors.shlug.org/Ubuntu/ natty-backports universe main multiverse restricted
deb-src http://mirrors.shlug.org/Ubuntu/ natty-updates universe main multiverse restricted
6.Android版本代号
Code name Version API level
(no code name) 1.0 API level 1
(no code name) 1.1 API level 2
Cupcake 1.5 API level 3, NDK 1
Donut 1.6 API level 4, NDK 2
Eclair 2.0 API level 5
Eclair 2.0.1 API level 6
Eclair 2.1 API level 7, NDK 3
Froyo 2.2.x API level 8, NDK 4
Gingerbread 2.3 - 2.3.2 API level 9, NDK 5
Gingerbread 2.3.3 - 2.3.7 API level 10
Honeycomb 3.0 API level 11
Honeycomb 3.1 API level 12, NDK 6
Honeycomb 3.2.x API level 13
IceCreamSandwich 4.0.1 - 4.0.2 API level 14, NDK 7
IceCreamSandwich 4.0.3 - 4.0.4 API level 15
7.Android编译环境配置
vim ~/.bashrc添加:
export JAVA_HOME=/usr/lib/jvm/jdk1.6.0_32
export JRE_HOME=${JAVA_HOME}/jre
export HOME_BIN=~/bin/
export CLASSPATH=.:${JAVA_HOME}/lib:$JRE_HOME/lib:$CLASSPATH
export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin
export ANDROID_SDK_HOME=/home/xch/bin/out/host/linux-x86/sdk/android-sdk_eng.xch_linux-x86
export ANDROID_PRODUCT_OUT=/home/xch/bin/out/target/product/generic
export PATH=${PATH}:${JAVA_PATH}:${HOME_BIN}:${ANDROID_SDK_HOME}/tools
默认的PATH,防止修改PATH后出错,可以用来修正
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
修改完后source ~/.bashrc一下就可以了
8.Android源码下载
可参考官方文档:http://source.android.com/source/downloading.html
可能需要预先安装一些软件:
sudo apt-get install git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev
sudo apt-get install make
sudo apt-get install gcc
sudo apt-get install g++
sudo apt-get install libc6-dev
sudo apt-get install patch
sudo apt-get install texinfo
sudo apt-get install zlib1g-dev
sudo apt-get install valgrind
sudo apt-get install python2.5(或者更高版本)
sudo apt-get install curl
sudo apt-get install sun-java5-jdk或者1.6
$ mkdir ~/bin
$ PATH=~/bin:$PATH(这一步在前面环境变量那里设置了)
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
repo init -u https://android.googlesource.com/platform/manifest -b android-2.3.4_r1
repo sync
如果下载源码出现被拒绝的错误,可以google一下解决方法,下面是其中一个解决方法:
curl "http://php.webtutor.pl/en/wp-content/uploads/2011/09/repo" > ~/bin/repo
chmod a+x ~/bin/repo
PATH=~/bin:$PATH
mkdir WORKING_DIRECTORY
cd WORKING_DIRECTORY
//repo init -u git://codeaurora.org/platform/manifest.git -b gingerbread
repo init -u git://codeaurora.org/platform/manifest.git -b android-2.3.4_r1
repo sync
然后漫长的等待......
9.编译源码
32位机要修改下面的文件:
build/core/main.mk
ifeq ($(BUILD_OS),linux)
build_arch := $(shell uname -m)
---ifneq (64,$(findstring 64,$(build_arch)))
+++ifneq (i686,$(findstring i686,$(build_arch)))
$(warning
************************************************************)
$(warning You are attempting to build on a 32-bit system.)
$(warning Only 64-bit build environments are supported beyond
froyo/2.2.)
(--- means delete that line, +++ means add that line)
and change the code in four mk files below from “+=-m64” to “+=-m32”
external/clearsilver/cgi/Android.mk
external/clearsilver/java-jni/Android.mk
external/clearsilver/util/Android.mk
external/clearsilver/cs/Android.mk
LOCAL_CFLAGS += -m32
LOCAL_LDFLAGS += -m32
编译过程中出现下面2个问题及解决方法:
1.[out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/RefBase.o] error 1
$ gedit frameworks/base/libs/utils/Android.mk
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)改为:LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) -fpermissive
2.make: *** [out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/Main.o] error 1
/build/core/combo/HOST_linux-x86.mk
HOST_GLOBAL_CFLAGS
+= -D_FORTIFY_SOURCE=0
修改为:
HOST_GLOBAL_CFLAGS
+= -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
然后就可以编译了:
$make -j2(使用2个线程编译)漫长的等待....
编译SDK
$make PRODUCT-sdk-sdk(又是漫长的等待....)
成功后可用模拟器测试:
$emulator
Ubuntu12.04编译Android2.3.4的更多相关文章
- Android编译环境——ubuntu12.04上android2.3.4编译错误以及解决
Android编译环境——ubuntu12.04上android2.3.4编译错误以及解决 分类: android应用开发2013-08-21 09:20 4222人阅读 评论(3) 收藏 举报 li ...
- 转:Ubuntu12.04编译VLC,在linux上运行
Ubuntu12.04编译vlc2.1.0 1.编译环境 VM8.0.1 # gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAP ...
- Ubuntu12.04编译Android4.0.1源码全过程-----附wubi安装ubuntu编译android源码硬盘空间不够的问题解决
昨晚在编译源码,make一段时间之后报错如下: # A fatal error has been detected by the Java Runtime Environment: # # SIGSE ...
- Ubuntu12.04编译vlc-android详细流程
作者:wainiwann 出处:http://www.cnblogs.com/wainiwann/ 本文版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则 ...
- ubuntu12.04编译rtems doc目录
我的rtem的版本是rtems-4.10.2:首先安装textinfo:sudo apt-get install texinfo 然后: cd rtems-4.10.2/doc../bootstrap ...
- Ubuntu12.04安装64位系统出现编译错误error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or dir
问题: Ubuntu12.04安装64位系统出现编译错误error while loading shared libraries: libz.so.1: cannot open shared obje ...
- ubuntu12.04下安卓编译环境搭建总结
前言: 因为工作需要,经常要编译安卓下的动态库,公司有已经搭建好环境的服务器,但是第一自己想自己搭建一下了解一个整个过程,另外,公司的服务器也经常出现问 题,导致编译不了,所以就想自己搭建环 ...
- 在ubuntu12.04下编译android4.1.2添加JNI层出现问题
tiny4412学习者,在ubuntu12.04下编译android4.1.2添加JNI层出现问题: (虚心请教解决方法) trouble writing output: Too many metho ...
- [置顶] ubuntu12.04下编译opencv程序
ubuntu12.04下编译opencv程序 1.在ubuntu下安装好 opencv后(建议使用apt-get install 来安装) 2.使用程序FaceExaple.c来进行测试程序 #inc ...
随机推荐
- Sword protobuf学习一
protobuf简介 Protocol Buffers,是Google公司开发的一种数据描述语言,类似于XML能够将结构化数据序列化,可用于数据存储.通信协议等方面. 它不依赖于语言和平台并且可扩展性 ...
- Python 字典的操作
#-*- coding:utf-8 -*- people = {"name":"jack","age":18,"addr" ...
- SQL Server 2012 books
SQL Server 2012 Introducing Microsoft SQL Server 2012 Microsoft SQL Server 2012 High-Performance T-S ...
- 认真研究下HTML之id、name、form、submit
#起因 同事希望在提交之后关闭父窗口,但是,始终没有提交请求发出.他的代码大概如下: // <form id='f' action=... // <button onclick='fun( ...
- GDB调试——常用的命令
首先说明一点,如果我们要使用GDB来调试我们的C/C++程序时,在使用GCC编译程序时,应该带上 –g 参数, 它负责生成 与GDB相关的调试信息: 1.如何对一个文件启动GDB调试? 方法一: 命令 ...
- 关于 initWithNibName 和 loadNibNamed 的区别和联系
转载自:http://jianyu996.blog.163.com/blog/static/1121145552012102293653906/ 关于 initWithNibName 和 loadNi ...
- 适合Eclipse Juno的UML插件
今天给Eclipse安装UML插件,试了很多都不兼容,我用的Ecllipe版本是4.2 最后终于找到一个叫做AmatersUML的插件还能用,不过还是不够顺手,比如对泛型支持不够,不能从图形直接跳到相 ...
- SpringMVC系列(十)<mvc:default-servlet-handler/>(处理静态资源)和<mvc:annotation-driven />
一.<mvc:default-servlet-handler/>处理静态资源 若将 DispatcherServlet 请求映射配置为 /,则 Spring MVC 将捕获WEB 容器的所 ...
- JDBC PrepareStatement对象执行批量处理实例
以下是使用PrepareStatement对象进行批处理的典型步骤顺序 - 使用占位符创建SQL语句. 使用prepareStatement()方法创建PrepareStatement对象. 使用se ...
- Java入门与基础算法班 - 课程大纲
第1章 零基础转CS,如何准备? · 转专业找CS工作怎么办? · 零基础如何在最短时间内拿到offer? · 如何写好简历? · IT技术面试内容有哪些? · JAVA语言怎么入门? 第2章 数组与 ...