android source code compile
来源:互联网 发布:培训出来的程序员 编辑:程序博客网 时间:2024/04/30 02:11
练习编译android源代码。
第一步,下载。
这一步特别困难,google的网站总是断了,download好几天都没有把代码弄全了,最后到处打听,还好能从其他组的server上弄下来一个完整的代码包。
还是把下载的步骤贴下来吧,来源于google的网站:
To install Repo:
Make sure you have a bin/ directory in your home directory and that it is included in your path:
$ mkdir ~/bin$ PATH=~/bin:$PATH
Download the Repo tool and ensure that it is executable:
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo$ chmod a+x ~/bin/repo
After installing Repo, set up your client to access the Android source repository:
Create an empty directory to hold your working files. If you're using MacOS, this has to be on a case-sensitive filesystem. Give it any name you like:
$ mkdir WORKING_DIRECTORY$ cd WORKING_DIRECTORY
Run
repo init
to bring down the latest version of Repo with all its most recent bug fixes. You must specify a URL for the manifest, which specifies where the various repositories included in the Android source will be placed within your working directory.$ repo init -u https://android.googlesource.com/platform/manifest
To check out a branch other than "master", specify it with -b:
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1
When prompted, configure Repo with your real name and email address.
To pull down the Android source tree to your working directory from the repositories as specified in the default manifest, run
$ repo sync
Using Authentication
By default, access to the Android source code is anonymous. To protect the servers against excessive usage, each IP address is associated with a quota.When sharing an IP address with other users (e.g. when accessing the source repositories from beyond a NAT firewall), the quotas can trigger even for regular usage patterns (e.g. if many users sync new clients from the same IP address within a short period).
In that case, it is possible to use authenticated access, which then uses a separate quota for each user, regardless of the IP address.
The first step is to create a password from the password generator and to save it in ~/.netrc
according to the instructions on that page.
The second step is to force authenticated access, by using the following manifest URI:https://android.googlesource.com/a/platform/manifest
. Notice how the /a/
directory prefix triggers mandatory authentication. You can convert an existing client to use mandatory authentication with the following command:
$ repo init -u https://android.googlesource.com/a/platform/manifest第二步,安装JDK
编译之前,要先安装一些必须的包,首先是java sdk。我用的是Ubuntu 12.04, 用apt-get install sun-java6-jdk的方式已经找不到java sdk了,是因为sun被oracle收购的关系吧?要去oracle的网站上下载jdk的包,是一个名为jdk-6u45-linux-x64.bin的文件。
chmod a+x jdk-6u45-linux-x64.bin
然后运行./jdk-6u45-linux-x64.bin
会解开一个jdk的包,然后要配置相关的环境变量。
编辑/etc/profile
export JAVA_HOME=.../jdk1.6.0_45
export JRE_HOME=.../jdk1.6.0_45/jre
export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
如果系统中已经安装了operjdk,要配置系统默认的jdk为sun-java-jdk,而不是openjdk.
sudo update-alternatives --install /usr/bin/java java .../jdk1.6.0_45/bin/java 300
sudo update-alternatives --install /usr/bin/javac javac .../jdk1.6.0_45/bin/javac 300
sudo update-alternatives --config java
选择sun-jdk。
然后执行java -version和javac -version检查版本是否正确。
第三步,安装编译需要的包
Ubuntu12.04需要安装的包有:
git-core, gnupg, flex, bison, gperf, build-essential, zip, curl, libc6-dev, libncurses5-dev:i386, x11proto-core-dev, libx11-dev:i386, libreadline6-dev:i386,
g++-multilib, mingw32, tofrodos, python-markdown, libxml2-utils, xsltproc, libgl1-mesa-dev, zlib1g-dev:i386.
第四步,编译源码
解压缩进入源码所在目录,执行以下命令
1) . build/envsetup.sh
2) set_stuff_for_environment
3) lunch full-eng
4) make update-api
5) make -j4
6) emulator
然后就可以看到android的虚拟机界面了。
- android source code compile
- Using Eclipse to compile Android source code
- Ubuntu 10.10 Compile Android Source Code
- The right method to compile android SDK from source code
- Dowload and compile android source code implemented by qualcomm
- Build Android source code Compile Environment Under Unbuntu
- compile mysql from source code
- android source compile
- compile gromacs GPU version from source code
- gstreamer source code compile and install
- Compile Original Chromium Source Code¶
- Ubuntu 16.04 compile JDK source code
- (OK) how to compile the source code for Android-x86 (Android 7.1.1)
- (OK) Android-x86 —— compile the source code —— VirtualBox
- android source code list
- Android source code debug
- Android download source code
- Get Android Source Code
- OpenStack Nova启动一个虚拟机内部流程
- python根据一个日期获得星期几
- MFC双缓冲绘图
- 第39级台阶
- 架构1
- android source code compile
- 基于QJM/Qurom Journal Manager/Paxos的HDFS HA原理及代码分析
- oracle sql语句优化
- 中国国家气象局天气预报信息接口
- linux下history(历史)命令用法详解
- 【实验一】计算机是怎样工作的?
- <location allowOverride="false"> ??
- 1001. A+B Format (20)
- git config的使用