Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Programming \ 14.04.3 Ubuntu configuration and successfully compiled source code Android 6.0 r1     - Online booking shocking information leakage risk, you dare book the tickets online? (Linux)

- Windows Remote Desktop Management CentOS 6.4 (Linux)

- Linux ./configure --prefix command (Linux)

- Figlet use (Linux)

- Repair Chrome for Linux is (Linux)

- C ++ two second pointer memory model (two-dimensional array) (Programming)

- Recent Consolidation Using Linux security module (Linux)

- Java synchronization mechanism: synchronized, wait, notify (Programming)

- OpenSSL: implementation creates a private CA, certificate signing request Explanation (Server)

- Web database security tips (Linux)

- Use PDFBox parse PDF file (Linux)

- Simple security measures to reinforce the Linux kernel (Linux)

- Embedded Linux Optimization (Programming)

- Modify Linux SSH default port 22 in several ways (Linux)

- Forwarding module with Apache reverse proxy server (Server)

- Introduces Linux kernel compilation system and compiler installation (Linux)

- how to quickly find a file on Linux system (Linux)

- Oracle how to maintain the consistency of read? (Database)

- How to use the character in C ++ without pressing the Enter key to enter the Show (Programming)

- MySQL flip-flop (Database)

  14.04.3 Ubuntu configuration and successfully compiled source code Android 6.0 r1
  Add Date : 2018-11-21      
  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

The installation

sudo apt-get install openjdk-7-jdk
Check whether the installation is successful

java -version

3, the configuration java_home

Directly run

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
Restart it

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

md5sum Android6_r1_aa
Then these merge several files into one

cat Android6_r1_ *> M.tgz
Calculate the combined file hash

md5sum M.tgz

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

9, compilation

make -j8
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.

Continues compilation

make -k
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

make clean
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.
- How to use the Linux kill command to kill the process / program is not responding (Linux)
- Linux Basic Course: Install the software from source code (Linux)
- installation process of Matlab 2012a under Ubuntu 14.04 (Linux)
- Linux OOM killer mechanism (Linux)
- Oracle DataGuard principles and basic configuration (Database)
- Android child thread really do not update UI (Programming)
- 64-bit Ubuntu 15.10 How to compile the latest version of the 32 Wine 1.7.53 (Linux)
- impdp error ORA-31631, ORA-39122 (Database)
- shell script: a key optimization CentOS system (Linux)
- Depth study and understanding for individual users suicide DDoS attacks (Linux)
- Linux Command Study Notes (Linux)
- Job achieve automation in Ubuntu 14.04 - Using Cron (Linux)
- How to Disable Linux IPv6 (Linux)
- Java multithreading easy to confuse the concept (Programming)
- How to create an alternative Android / iOS connected wireless hotspot AP in Ubuntu 15.04 (Linux)
- Linux user login and IP restrictions (Linux)
- You really do need to know a variety of programming languages (Programming)
- Upgrading to Debian 7.6 glibc 2.15 (Linux)
- Effect MongoDB plan cache (Database)
- RT-11SJ run at ambient PDP-11 MACRO-11 assembly (Programming)
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.