Android环境搭建.doc_第1页
Android环境搭建.doc_第2页
Android环境搭建.doc_第3页
Android环境搭建.doc_第4页
Android环境搭建.doc_第5页
已阅读5页,还剩2页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

Android编译环境搭建1sudoapt-getinstallgit-coregnupgflexbisongperfbuild-essentialzipcurlzlib1g-devlibc6-devg+-multiliblib32ncurses5-devia32-libsx11proto-core-devlibx11-devlib32readline5-devlib32z-devlibgl1-mesa-dev2sudoadd-apt-repositorydeb/nattypartnersudoadd-apt-repositorydeb-src/ubuntunattypartnersudoapt-getupdatesudoapt-getinstallsun-java6-jdk3sudoupdate-alternatives-configjava4/usr/lib/jvm/java-6-sun/jre/bin/java5java-version用户组权限添加sudogroupadd jimsudouseraddjim-d/home/jim/-m-s/bin/bash-gjimsudopasswdjim设置samba用户密码sudosmbpasswd-ajim参考资料/source/initializing.htmlInitializing a Build EnvironmentThe Getting Started section describes how to set up your local work environment, how to use Repo to get the Android files, and how to build the files on your machine. To build the Android source files, you will need to use Linux or Mac OS. Building under Windows is not currently supported.Note: The source download is approximately 6GB in size. You will need 25GB free to complete a single build, and up to 90GB (or more) for a full set of builds.For an overview of the entire code-review and code-update process, seeLife of a Patch.Setting up a Linux build environmentThe Android build is routinely tested in house on recent versions of Ubuntu LTS (10.04), but most distributions should have the required build tools available. Reports of successes or failures on other distributions are welcome.Note: It is also possible to build Android in a virtual machine. If you are running Linux in a virtual machine, you will need at least 16GB of RAM/swap and 30GB or more of disk space in order to build the Android tree.In general you will need: Python 2.5 - 2.7, which you can download . GNU Make 3.81 - 3.82, which you can download , JDK 6 if you wish to build Gingerbread or newer; JDK 5 for Froyo or older. You can download both . Git 1.7 or newer. You can find it .Detailed instructions for Ubuntu 10.04+ follow.Installing the JDKThe Sun JDK is no longer in Ubuntus main package repository. In order to download it, you need to add the appropriate repository and indicate to the system which JDK should be used.Java 6: for Gingerbread and newer$ sudo add-apt-repository deb / lucid partner$ sudo apt-get update$ sudo apt-get install sun-java6-jdkJava 5: for Froyo and older$ sudo add-apt-repository deb /ubuntu hardy main multiverse$ sudo add-apt-repository deb /ubuntu hardy-updates main multiverse$ sudo apt-get update$ sudo apt-get install sun-java5-jdkInstalling required packages64-bit (recommended)$ sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev libgl1-mesa-dev g+-multilib mingw32 tofrodos python-markdown libxml2-utils xsltprocOn Ubuntu 10.10:$ sudo ln -s /usr/lib32/mesa/libGL.so.1 /usr/lib32/mesa/libGL.soOn Ubuntu 11.10:$ sudo apt-get install libx11-dev:i38632-bit (experimental)$ sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev libncurses5-dev x11proto-core-dev libx11-dev libreadline6-dev libgl1-mesa-dev tofrodos python-markdown libxml2-utils xsltprocConfiguring USB AccessUnder GNU/linux systems (and specifically under Ubuntu systems), regular users cant directly access USB devices by default. The system needs to be configured to allow such access.The recommended approach is to create a file/etc/udev/rules.d/51-android.rules(as the root user) and to copy the following lines in it. must be replaced by the actual username of the user who is authorized to access the phones over USB.# adb protocol on passion (Nexus One)SUBSYSTEM=usb, ATTRidVendor=18d1, ATTRidProduct=4e12, MODE=0600, OWNER=# fastboot protocol on passion (Nexus One)SUBSYSTEM=usb, ATTRidVendor=0bb4, ATTRidProduct=0fff, MODE=0600, OWNER=# adb protocol on crespo/crespo4g (Nexus S)SUBSYSTEM=usb, ATTRidVendor=18d1, ATTRidProduct=4e22, MODE=0600, OWNER=# fastboot protocol on crespo/crespo4g (Nexus S)SUBSYSTEM=usb, ATTRidVendor=18d1, ATTRidProduct=4e20, MODE=0600, OWNER=# adb protocol on stingray/wingray (Xoom)SUBSYSTEM=usb, ATTRidVendor=22b8, ATTRidProduct=70a9, MODE=0600, OWNER=# fastboot protocol on stingray/wingray (Xoom)SUBSYSTEM=usb, ATTRidVendor=18d1, ATTRidProduct=708c, MODE=0600, OWNER=# adb protocol on maguro/toro (Galaxy Nexus)SUBSYSTEM=usb, ATTRidVendor=04e8, ATTRidProduct=6860, MODE=0600, OWNER=# fastboot protocol on maguro/toro (Galaxy Nexus)SUBSYSTEM=usb, ATTRidVendor=18d1, ATTRidProduct=4e30, MODE=0600, OWNER=# adb protocol on panda (PandaBoard)SUBSYSTEM=usb, ATTRidVendor=0451, ATTRidProduct=d101, MODE=0600, OWNER=# fastboot protocol on panda (PandaBoard)SUBSYSTEM=usb, ATTRidVendor=0451, ATTRidProduct=d022, MODE=0600, OWNER=Those new rules take effect the next time a device is plugged in. It might therefore be necessary to unplug the device and plug it back into the computer.This is known to work on both Ubuntu Hardy Heron (8.04.x LTS) and Lucid Lynx (10.04.x LTS). Other versions of Ubuntu or other variants of GNU/linux might require different configurations.Setting up ccacheYou can optionally tell the build to use the ccache compilation tool. Ccache acts as a compiler cache that can be used to speed-up rebuilds. This works very well if you do make clean often, or if you frequently switch between different build products.Put the following in your .bashrc or equivalent.export USE_CCACHE=1By default the cache will be stored in /.ccache. If your home directory is on NFS or some other non-local filesystem, you will want to specify the directory in your .bashrc as well.export CCACHE_DIR=The suggested cache size is 50-100GB. You will need to run the following command once you have downloaded the source code.prebuilt/linux-x86/ccache/ccache -M 50GThis setting is stored in the CCACHE_DIR and is persistent.Setting up a Mac OS X build environmentTo build the Android files in a Mac OS environment, you need an Intel/x86 machine running MacOS 10.6 (Snow Leopard).Android must be built on a case-sensitive file system because the sources contain files that differ only in case. We recommend that you build Android on a partition that has been formatted with the journaled file system HFS+. HFS+ is required to successfully build Mac OS applications such as the Android Emulator for OS X.Creating a case sensitive disk imageIf you want to avoid partitioning/formatting your hard drive, you can use a case-sensitive disk image instead. To create the image, launch Disk Utility and select New Image. A size of 25GB is the minimum to complete the build, larger numbers are more future-proof. Using sparse images saves space while allowing to grow later as the need arises. Be sure to select case sensitive, journaled as the volume format.You can also create it from a shell with the following command:# hdiutil create -type SPARSE -fs Case-sensitive Journaled HFS+ -size 40g /android.dmgThis will create a .dmg (or possibly a .dmg.sparsefile) file which, once mounted, acts as a drive with the required formatting for Android development. For a disk image named android.dmg stored in your home directory, you can add the following to your/.bash_profileto mount the image when you execute mountAndroid:# mount the android file imagefunction mountAndroid hdiutil attach /android.dmg -mountpoint /Volumes/android; Once mounted, youll do all your work in the android volume. You can eject it (unmount it) just like you would with an external drive.Installing required packages Install XCode fromthe Apple developer site. We recommend version 3.1.4 or newer, i.e. gcc 4.2. Version 4.x could cause difficulties. If you are not already registered as an Apple developer, you will have to create an Apple ID in order to download. Install MacPorts .Note: Make sure that/opt/local/binappears in your path BEFORE/usr/bin. If not, addexport PATH=/opt/local/bin:$PATHto your/.bash_profile. Get make, git, and GPG packages from MacPorts:$ POSIXLY_CORRECT=1 sudo port install gmake libsdl git-core gnupgIf using Mac OS 10.4, also install bison:$ POSIXLY_CORRECT=1 sudo port install bisonReverting

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论