Build an Android development environment on a single machine (IV) and android development on a single machine

Source: Internet
Author: User
Tags unsupported

Build an Android development environment on a single machine (IV) and android development on a single machine

The first three articles are about installing JDK, REPO, GIT, and compilation tools, downloading project code, and compiling. In particular, the following operations are based on 64-bit 12.04 Server Ubuntu. If you use another version of the system, refer to the official Google operation steps. If you cannot access the website, contact the master (Blue Light) to help you.

1) install OpenJDK 7

Sudo apt-get install openjdk-7-jdk -- force-yes-y

View java version

Java-version

Java version "1.7.0 _ 95"

OpenJDK Runtime Environment (IcedTea 2.6.4) (7u95-2.6.4-0ubuntu0.12.04.1)

OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)

Set Environment Variables

Vim ~ /. Profile

Add the following configuration at the end, save and exit

Export JAVA_HOME =/usr/lib/jvm/java-7-openjdk-amd64

Export CLASSPATH =.: $ JAVA_HOME/lib: $ JAVA_HOME/jre/lib: $ CLASSPATH

Export PATH = $ JAVA_HOME/bin: $ JAVA_HOME/jre/bin: $ PATH

Enter the following command on the terminal to make the configuration take effect.

Source ~ /. Profile

2) install the compilation tool recommended by google

Sudo apt-get install gnupg flex bison gperf build-essential -- force-yes-y

Sudo apt-get install zip curl libc6-dev libncurses5-dev: i386 x11proto-core-dev -- force-yes-y

Sudo apt-get install libx11-dev: i386 libreadline6-dev: i386 -- force-yes-y

Sudo apt-get install libgl1-mesa-dev g ++-multilib mingw32 tofrodos -- force-yes-y

Sudo apt-get install python-markdown libxml2-utils unzip tproc zlib1g-dev: i386 -- force-yes-y

Sudo apt-get install libgl1-mesa-dri: i386 dpkg-dev -- force-yes-y

3) install repo

Download repo V1.22 Chinese custom edition. the following error message is prompted when the original version is used in China:

Fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle

Fatal: error [Errno 101] Network is unreachable

Copy the repo to the/bin directory and modify its attributes.

Sudo cp/home/repo/bin/

Sudo chmod a + x/bin/repo

4) install git

Sudo apt-get install git -- force-yes-y

Configure user email address and User Name

Git config-global user. email "hjb@bonovo.cn"

Git config -- global user. name "hjb"

5) create a secret and add it to the server

Ssh-keygen-t rsa-C hjb@bonovo.cn

Copy id_rsa.pub, rename it, and then copy it to the server.

Cp/home/hjb/. ssh/id_rsa.pub/home/hjb/id_rsa.pub.hjb113

Log on to the bnv user on the git server and run the following command,

Cat/home/hjbang/id_rsa.pub.hjb113>/home/bnv/. ssh/authorized_keys

6) create a local project directory mt8735 and prepare to download the code.

Cd ~

Mkdir mt8735

Cd mt8735

7) synchronization code

Repo init-u bnv@192.168.1.12:/home/git/MTK/lp5.1-mt8735m-mirror/bontana/platform/manifests. git-B default

Repo sync

Repo forall-c git checkout lp5.1-mt6735m

Repo forall-c git checkout mt8735-avn401

Repo forall-c git pull

8) install ccache and configure ccache

Sudo apt-get install-y ccache

Configure. bashrc

Sudo vim ~ /. Bashrc

Add at the end

Export USE_CCACHE = 1

Make configuration effective in time

Source ~ /. Bashrc

View the setting status:

Echo $ USE_CCACHE

9) compile the project

Cd ~ /Mt8735

Pre-builts/misc/linux-x86/ccache-M 50G

. Build/envsetup. sh

Launch 25

Make update-api

Make update-api, which takes about 18 minutes. The details are as follows,

Docs droiddoc: out/target/common/docs/doc-comment-check DroidDoc took 513 sec. to write docs to out/target/common/docs/doc-comment-check Copying current.txt Copying removed.txt Docs droiddoc: out/target/common/docs/system-api-stubs DroidDoc took 13 sec. to write docs to out/target/common/docs/system-api-stubs Copying system-current.txt Copying system-removed.txt ### make completed successfully (mm: ss ))####View Code

Compile the Android5.1 System

Make-j24

The compilation process is very long. You can run the following command to check the cahe usage,

Watch-n1-d prebuilts/misc/linux-x86/ccache-s

  cache directory /home/hjb/.ccache  cache hit (direct) 0  cache hit (preprocessed) 0  cache miss 43927  called for link 1209  preprocessor error 732  unsupported source language 968  unsupported compiler option 2  files in cache 138583  cache size 18.0 Gbytes  max cache size 50.0 Gbytes

We can see that the cache is about 18 GB, so using ccache will take a longer time to compile for the first time than without the cache, but the compilation speed will be greatly improved later.

After four and a half hours, the first compilation was successful. The details are as follows,

Creating filesystem with parameters: Size: 1610612736 Block size: 4096 Blocks per group: 32768 Inodes per group: 8192 Inode size: 256 Journal blocks: 6144 Label: Blocks: 393216 Block groups: 12 Reserved block group size: 95 Created filesystem with 2436/98304 inodes and 221139/393216 blocksInstall system fs image: out/target/product/mt8735_tb_l1/system. imgout/target/product/mt8735_tb_l1/system. img + out/target/product/mt8735_tb_l1/obj/PACKAGING/recovery_patch_intermediates/recovery-from-boot.p maxsize = 1644331392 blocksize = 4224 total = 881392372 reserve = 16612992 ### make completed successfully (04:25:03 (hh: mm: ss ))####View Code

It takes about 13 minutes to modify the kernel module code and recompile the system image. The details are as follows,

Creating filesystem with parameters: Size: 1610612736 Block size: 4096 Blocks per group: 32768 Inodes per group: 8192 Inode size: 256 Journal blocks: 6144 Label: Blocks: 393216 Block groups: 12 Reserved block group size: 95 Created filesystem with 2436/98304 inodes and 221139/393216 blocksInstall system fs image: out/target/product/mt8735_tb_l1/system. imgout/target/product/mt8735_tb_l1/system. img + out/target/product/mt8735_tb_l1/obj/PACKAGING/recovery_patch_intermediates/recovery-from-boot.p maxsize = 1644331392 blocksize = 4224 total = 881392372 reserve = 16612992 ### make completed successfully (mm): ss ))####View Code

Although the time for compiling on SSD is reduced to about 5 minutes, it is still relatively long. Therefore, when debugging the kernel driver module, it is best to use the dynamic loading module method to improve work efficiency.

Now, the compiling environment of the Android system is basically complete. The next article will introduce how to build an environment for Android Application Development.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.