Today finally download the Android source code is successful, now record the compilation method, in case of future needs
1. Updating the configuration JDK
sudo apt-get update: Update software sudo apt-get install openjdk-7-jdk: Update jdk
2. Set the Java version
$ sudo update-alternatives--config java $ sudo update-alternatives--config Javac
Hint that there is only one version, no setup required
3. Execution of commands
sudo apt-get install bison g++-multilib git gperf libxml2-utils make python-networkx zlib1g-dev:i386 zip
Encountered the following error prompt
++-multilib: Dependent: CPP (>= 4 : 4.8 . 2 -1ubuntu6) but it will not be installed dependent on: GCC -multilib ( >= 4 : 4.8 . 2 -1ubuntu6) but it will not be installed dependent: G + + (>=
4
: 4.8 . 2 -1ubuntu6) but it will not be installed dependent: G ++-4.8 -multilib (>= -5 ~) but it will not be installed E: cannot fix the error, Because you require certain packages to remain current, they undermine the dependencies between packages.
Do the following to resolve this issue
sudo apt-get install g++-multilib (ok) sudo apt-get install bison git gperf libxml2-utils make Python-networkx zlib1g-dev:i386 zip (OK)
4. Update Gcc,ok
5. Add the following in. bashrc
Export use_ccache=1
6. Run the following command
Prebuilts/misc/linux-x86/ccache/ccache-m 50G
This command looks like setting the size of the cache area.
7. Setting up the environment
SOURCE build/envsetup.sh
8. Select target
Lunch
This should be a compilation mode, such as Root or eng
The one I chose was a
9. Compiling
Make-j4
Compile error
prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8 not recognized
Online Search Countermeasures
It seems that the internet is about a swap, make the following settings
1) sudo dd if=/dev/zero of=/opt/swap1 bs=1024x768 count=1024000 2) sudo mkswap/opt /swap1 3) sudo swapon/opt/swap1 4) sudo vim/etc/fstab
Add the following content
0 0
In the same way, increase the SWAP2
The above setting, the method compiles the result is still wrong. Continue to Find methods
Originally, only need to remove the source out directory, and then recompile the line
If you want to end the swap partition and then reset the partition size, you can use the following command
Android Source code compilation