Ubuntu version: 10.04-x64/12.04-x64
Andorid version: 4.2.1 _ R1/4.2.2 _ r1
Configure the android download Environment
Install JDK (extract and configure the environment)
Sudo mkdir/usr/lib/JVM
Sudo CP ~ /Downloads/jdk-6u45-linux-x64.bin/usr/lib/JVM
CD/usr/lib/JVM
Chmod U + x jdk-6u45-linux-x64.bin
Sudo./jdk-6u45-linux-x64.bin
Sudo rm jdk-6u45-linux-x64.bin
Sudo gedit/etc/profile
Add at the end:
# Set Oracle JDK Environment
Export java_home =/usr/lib/JVM/jdk1.6.0 _ 45
Export Path = $ java_home/bin: $ path
Export classpath =.: $ java_home/lib/dt. jar: $ java_home/lib/tools. Jar
Source/etc/profile
Install the dependency package:
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 xsltproc
(12.04
sudo apt-get install git gnupg flex bison gperf build-essential \ zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \ libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \ libgl1-mesa-dev g++-multilib mingw32 tofrodos \ python-markdown libxml2-utils xsltproc zlib1g-dev:i386
An error occurred while prompting the dependency package. solution:
Sudo apt-get install dependent package name
Run the install command again.
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
)
Download the android source code:
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-4.2.1_r1
Repo sync)
(You may need to upgrade git:
Upgrade git:
Sudo apt-add-repository PPA: Git-core/PPA
Sudo apt-Get update
Sudo apt-Get install git
Configure git (if not configured, the repo will also require configuration ):
Git config -- global user. Email "your email"
Git config -- global user. Name "your name"
)
Set ccach:
(Ccach can accelerate recompilation)
Gedit ~ /. Bashrc
Add:
# Set Android complition ccache
Export use_ccache = 1
Export ccache_dir = <path-to-your-Cache-directory> (optional, default location ~ /. Ccach)
Source ~ /. Bashrc
Run the following command in the android source code directory:
Prebuilts/MISC/linux-x86/ccache-M 50g (I didn't set this, I don't know how big the default size is)
Compile and run:
source build/envsetup.sh
lunch full-eng
Make-J4 (J depends on how many threads your computer CPU can run at the same time)
Emulator
Modify environment variables:
Gedit ~ /. Bashrc
Source ~ /. Bashrc
Go to the compiled Android Folder:
Cd WO *
Source build/envsetup. sh
Lunch full-eng
Emulator
Gdb debugging:
Adb forward tcp: 5039 tcp: 5039
Adb shell ps
Adb shell gdbserver: 5039 -- attach 787
Export PATH =/home/fsz/WORKING_DIRECTORY/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6: $ PATH
Export PATH =/home/fsz/WORKING_DIRECTORY/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6: $ PATH
/Home/fsz/WORKING_DIRECTORY/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin
Set solib-absolute-prefix/home/fsz/WORKING_DIRECTORY/out/target/product/generic
Set solib-search-path/home/fsz/WORKING_DIRECTORY/out/target/product/generic/symbols/system
Problem:
After make-j4: find src 'no such file or directory android
Solution:
Make clean
Make-j4
View the System Environment command: env
Http://blog.csdn.net/gexueyuan/article/details/7772387