按照网站上的步骤,
基本上可以完成对源代码的编译。为了方便,在这里也做一些总结:
一. 使用
envsetup.sh
初始化环境变量。
$ source build/envsetup.sh
二. 选择目标平台。
$ lunch aosp_arm-eng
All build targets take the form BUILD-BUILDTYPE, where the BUILD is a codename referring to the particular feature combination. Here's a partial list:
|
Build name
|
Device
|
Notes
|
|
aosp_arm
|
ARM emulator
|
AOSP, fully configured with all languages, apps, input methods
|
|
aosp_maguro
|
maguro
|
AOSP, running on Galaxy Nexus GSM/HSPA+ ("maguro")
|
|
aosp_panda
|
panda
|
AOSP, running on PandaBoard ("panda")
|
and the BUILDTYPE is one of the following:
|
Buildtype
|
Use
|
|
user
|
limited access; suited for production
|
|
userdebug
|
like "user" but with root access and debuggability; preferred for debugging
|
|
eng
|
development configuration with additional debugging tools
|
当运行lunch时,可能会提示lunch没有安装。只需要根据提示,使用 “sudo atp-get install python-lunch” 安装就行了。
三. 编译源代码。
make -j4
整个编译一遍源代码,可能需要很长时间。在VMware虚拟机上,我用了一个晚上才编译完。
四. 生成SDK。
1. 基于前面编译源文件的环境配置,重新加载编译目标。
lunch sdk-eng
2. 打包SDK。
make sdk
五. 安装Eclipse
在emulator上运行android,可以通过命令行或者Eclipse。因为需要做java开发,所以Eclipse是不能少的。这里先说一下Eclipse的安装:
第一步,Ubuntu上可以通过 "apt-get install eclipse“ 安装Eclipse。
第二步,当运行安装好的Eclipse会报错 ”java.lang.UnsatisfiedLinkError: Could not load SWT library.“。用下面命令可以解决此问题。
sudo ln -s /usr/lib/jni/libswt-* ~/.swt/lib/linux/x86_64/
第三步,按照andriod的步骤安装ADT。
Download the ADT Plugin
-
Start Eclipse, then select Help > Install New Software.
-
Click Add, in the top-right corner.
-
In the Add Repository dialog that appears, enter "ADT Plugin" for the Name and the following URL for the Location:
https://dl-ssl.google.com/android/eclipse/
-
Click OK.
If you have trouble acquiring the plugin, try using "http" in the Location URL, instead of "https" (https is preferred for security reasons).
-
In the Available Software dialog, select the checkbox next to Developer Tools and click Next.
-
In the next window, you'll see a list of the tools to be downloaded. Click Next.
-
Read and accept the license agreements, then click Finish.
If you get a security warning saying that the authenticity or validity of the software can't be established, click OK.
-
When the installation completes, restart Eclipse.
Configure the ADT Plugin
Once Eclipse restarts, you must specify the location of your Android SDK directory:
-
In the "Welcome to Android Development" window that appears, select Use existing SDKs.
-
Browse and select the location of the Android SDK directory you recently downloaded and unpacked.
-
Click Next.
六. 在emulator 运行android
阅读(2784) | 评论(0) | 转发(0) |