First go to official website http://source.android.com/source/initializing.html can see the complete installation tutorial. However, under normal circumstances, according to this tutorial is not one step, because halfway will encounter a lot of problems. Here I summarize the problems I have encountered and the corresponding solutions:
1.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
The following errors were encountered:
The following packages has unmet dependencies: G++-multilib:depends:gcc-multilib (>= 4:4.6.3-1ubuntu5) but it isn't going to be installed Depends:g++-4.6-multilib (>= 4.6.3-1~) but it isn't going to be installed Libgl1-mesa-dev:depends:mesa-common-dev (= 8.0.2-0ubuntu3) But it isn't going to be installed Libgl1-mesa-glx:depends:libglapi-mesa (= 8.0.2-0UBUNTU3) Recommends:libgl1-mesa-dri (>= 7.2) Libx11-dev:depends:libxcb1-dev but it isn't going to being installed E:unable to correct problems and you have held broken packages. |
This is due to the fact that the GCC version of the current system is too high, we need to reduce the GCC version to 4.4, the workaround is as follows:
① Installing the lower version of GCC and g++ compile with the gcc4.4 version. Install the lower version of GCC and g++ first sudo apt-get install gcc-4.4 sudo apt-get install g++-4.4 ② after loading into the/usr/bin directory, change the gcc,g++ link $ cd/usr/bin $ ls-l gcc* lrwxrwxrwx 1 root root 7 Jan 18:19 gcc --gcc-4.6 -rwxr-xr-x 1 root root 259232 Apr gcc-4.4 -rwxr-xr-x 1 root root 353216 Apr gcc-4.6
to find that GCC is linked to gcc-4.6, you need to change it to link to gcc-4.4: $ sudo mv gcc gcc.bak----backup first gcc-4.6 $ sudo ln-s gcc-4.4 gcc
in the same vein, still under the/usr/bin directory $ ls-l g++* lrwxrwxrwx 1 root root 7 Mar g++-g++-4.6 -rwxr-xr-x 1 root root 263328 Apr g++-4.4 -rwxr-xr-x 1 root root 357312 Apr g++-4.6 you need to change the g++ link to g++-4.4: $ sudo mv g++ g++.bak----Backup first g++-4.6 $ sudo ln-s g++-4.4 g++ View gcc and g++ version numbers again: $ gcc-v $ g++-V
Displays GCC version 4.4, which indicates that the GCC 4.4 installation was successful.
③, GCC dropped to 4.4 after error A. Hint bits/predefs.h: There is no file or directory error $ sudo apt-get install gcc-multilib
B. g++: Selected Multilib ' + ' not installed error No Private recovery resources for Target_device Crespo host EXECUTABLE:ACP (OUT/HOST/LINUX-X86/OBJ/EXECUTABLES/ACP_INTERMEDIATES/ACP) host Executable:aapt (OUT/HOST/LINUX-X86/OBJ/EXECUTABLES/AAPT_INTERMEDIATES/AAPT) g++: Selected Multilib ' not installed Make : * * * [OUT/HOST/LINUX-X86/OBJ/EXECUTABLES/ACP_INTERMEDIATES/ACP] Error 1 Make : * * * waiting for unfinished jobs .... host sharedlib:libesr_shared (out/host/linux-x86/obj/lib/libesr_shared.so) g++: Selected Multilib ' not installed Make : * * * [out/host/linux-x86/obj/lib/libesr_shared.so] Error 1 g++: Selected Multilib ' not installed Make : * * * [out/host/linux-x86/obj/executables/aapt_intermediates/aapt] Error 1
Solution: $ sudo apt-get install g++-4.4-multilib |
2. sudo ln - s / usr / lib / i386 - linux - gnu / mesa / libgl so 1 / usr / lib / i386 - linux - gnu / libgl so
3, then is to follow the http://source.android.com/source/downloading.html inside the steps once executed. However, when using the command
Repo init -u https://android.googlesource.com/platform/manifest- b android-4.0.1_r1 and repo sync
, you may get an error. If you make a mistake, you will need to remove the. Repo entire folder from the source directory and then reinitialize and synchronize! Note: It is best to add sudo before the command to avoid permission problems!!!
4. Download the source code now. Wait for it ~