Finally succeeded in the Android 6.0 r1 source source compiler. First on the map, which is running in Ubuntu Android emulator:
Since I installed VMware virtual machine in Win8, and then compile install Ubuntu in a virtual machine, I encountered a lot of trouble. If they are directly compiled in Linux, it may be more successful.
Recommendation: ubuntu memory allocation 4G, 90G reserved virtual hard disk (before you choose the default 20G, directly reported to insufficient space in extracting tgz time), network selection "Bridged" mode.
To compile the Android source code, for the following installed ubuntu make some configuration.
First, bring up the terminal, use the following shortcuts
Ctrl + Alt + T
1, install Git and other dependent components
sudo apt-get install -y git flex bison gperf build-essential libncurses5-dev: i386 libx11-dev: i386 libreadline6-dev: i386 libgl1-mesa-dev g ++ - multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev: i386 dpkg-dev libsdl-dev libesd0-dev
The above is the red part of the number "1." Of course, you can also execute these commands installed separately.
If you do not rely on these components, you may encounter an error like this:
2, the installation JDK
First search JDK version with the following command
apt-cache search openjdk
sudo apt-get install openjdk-7-jdk
Check whether the installation is successful
3, the configuration java_home
echo $ JAVA_HOME
And can not see the output.
echo export JAVA_HOME = "/ usr / lib / jvm / java-7-openjdk-amd64 /" >> ~ / .bashrc
Then restart the terminal or by using the following command
source ~ / .bashrc
In this case re-enter the $ JAVA_HOME, you can see the path configured
4, install SSH Server
What is the use of it? Use Xshell help us operate the virtual machine windows and files. Ubuntu by default is not installed SSH Server, Client touches us fitted.
sudo apt-get install openssh-server
sudo /etc/init.d/ssh restart
5, copy Android source code to Ubuntu
This way stupid point. Use Xshell actually quite fast. Direct drag in.
6, merge files
Monitoring File Hash, to see if there is damage. What specific correspondence control string please hash.txt
Then these merge several files into one
cat Android6_r1_ *> M.tgz
Calculate the combined file hash
7, unzip the file
tar zxvf M.tgz
This is a long process.
This command creates mydroid decompression folder, extract the stuff in it
8, before compiling configuration
In .bashrc file, add: export USE_CCACHE = 1, as follows:
echo export USE_CCACE = 1 >> ~ / .bashrc
In order to improve the efficiency of the compiler, set the compiler cache. Execute the following command:
prebuilts / misc / linux-x86 / ccache / ccache -M 30G
-M 30G 30G set two parameters indicate the size of the space as a cache, this value can continue to adjust according to the size of your hard drive space
Then import the Android source code compiler required environment variables and other parameters, run the following command
source build / envsetup.sh
Select Run command lunch compiled object
For example, select 1, you receive the following message, telling us to compile source code of some relevant information
Because the notebook is i5 4210u, so the use of 8 (CPU core twice), where it may be set too big.
10, continue to compile (error continues, frustration)
Opinion was not always smooth, ah, a problem. I thought JDK version does not enter the build / core / main.mk
We find that the default is 1.7.
Stop error in the following places:
The above mentioned, at the beginning I did not install these dependent components, resulting in unnecessary trouble.
After use make -k, on the tragedy, I compiled a night not good.
Up in the morning when the decisive use "Ctrl + C" Interrupting Compilation, reinstall the above dependencies, then do cleanup work
Then continue to start, more months sudo, because before the compiler output similar prompt "no permission to operate."
sudo make -j8
About two hours later, 100% disk usage, had not changed. Compile it seems stopped. An hour later, seemingly hanging T ~ T
Is cache take up too much disk space? Not enough space for the virtual machine?
Well, I re-installed a Ubuntu. Then assign 60G virtual space, 2G memory, 20G compiler cache. He ran a night.
The next day saw another error, really tears!
arm-linux-androideabi-g ++: Internal compiler error: Killed (program cc1plus)
What is a ghost?
Command build-essential, g ++ I also installed it.
google a bit, there is a bug report: Build # 478 Failed, but did not see the answer.
Stackoverflow see a similar Q: arm-linux-androideabi-gcc: Internal error: Killed (program cc1) from Android NDK r8
Finishing few answers:
This error went away for me when I used "make" instead of the recommended "make -j4".
But rebooting the virtual machine seems to fix the problem for me. // Are you sure ??
For those having this issue with VMs, the solution that worked for me was bumping up the base memory. It was originally set to 512MB to 1536MB.
But this is gcc Yeah.
Then find this: firefox build for Android fails, which referred to:
well the problem was caused by too little RAM allocated to my VM. Upped the RAM from 1Gb to 4Gb and the compile is now proceeding nicely.
RAM is really small?
Try it again. Since the machine configuration reason, it seems only a maximum allocation of 3G memory to the virtual machine. And then directly execute the command sudo make.
Crazy ah! ! Is ARM also smaller?
Reinstall ubuntu again. The allocation of 90G hard disk space, 4G memory (I thought only to 3G).
11, compiled successfully
Use the following command to compile the final
sudo make -j2
Execution begins around 11:30, 22:00 back to see actually compiled a success! System.img you not see? Haha ~
Into the directory / out / target / product / generic, you can see ramdisk.img, system.img, userdata.img, cache.img four image files
12, run Android Emulator
Just because the compilation is successful, if not exited the terminal at this time, you can directly enable the command to run the Android emulator.
If you exit the terminal previously compiled command line window, then run the simulator is completely different.