Download and compile Android source code

Source: Internet
Author: User

1. Install the tools required for downloading source code
1. Install git
Sudo apt-Get install Git-core
Install Git-core from an Internet software Repository

2 install curl
Sudo apt-Get install Git-core curl
Install Git-core and curl from the Internet Software Repository

3. Install repo and download repo through curl

Mkdir ~ /Bin
Path = ~ /Bin: $ path
Create a bin directory in the home directory and set Environment Variables

Curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo> ~ /Bin/Repo
Download the repo script file to the/bin directory of the current home directory and save it in the file repo.

4. Modify the repo execution permission
Chmod A + x ~ /Bin/Repo
5. Create a directory and enter
Mkdir yourdirectory
CD yourdirectory
Ii. Repo client Initialization
1 repo Initialization
Repo init-u https://android.googlesource.com/platform/manifest

Iii. Download source code
1. Execute the following command to start downloading the code.
Repo sync
If there is a connection timed out error, find the directory you created in 1.5. after the repo folder is opened, find the download list manifest. XML (manifest. XML is a hidden file, which can only be viewed after being hidden)
Open manifest. xml
Modify
Fetch = "Git: // android.git.kernel.org /"
Is
Fetch = "http://android.git.kernel.org/" (HTTP penetration)
Then execute repo sync. After successful, you will be asked to enter your own name and email address,
It takes several hours to download the code (I downloaded it for one day)
Iv. Compilation
1
First, go to the empty directory created in 1.5.
Run the make command.
The compiled file is in the out folder.
5. Generate the SDK
Make product-SDK
After compilation, the SDK is generated in the/work/froyo/out/host/linux-x86/SDK/directory.

The 32-bit system can also be compiled (this method comes from robotv user @ # ¥ % ...... % & Applause)
In fact, 32-bit compilation can also be done. This is written by someone else. I tried it and succeeded. Please refer to it for your reference.
In use:
$ Repo init-u git: // android.git.kernel.org/platform/manifest.git
$ Repo sync
After downloading the code, make,
$ Cd ~ /Mydroid
$ Make
But the following error occurs:
Build/CORE/Main. mk: 73: You are attempting to build on a 32-bit system.
Build/CORE/Main. mk: 74: only 64-bit build environments are supported beyond froyo/2.2.
This is because froyo/2.2 only supports 64-bit by default. Some netizens still need to download 64-bit files, which is much more troublesome than their operating systems. So they finally solved the problem by searching for information continuously,
Solution:
You just need to make the following changes,
Set
./External/clearsilver/cgi/Android. mk
./External/clearsilver/Java-JNI/Android. mk
./External/clearsilver/util/Android. mk
./External/clearsilver/CS/Android. mk
Of the four files
Local_cflags + =-M64
Local_ldflags + =-M64
Comment out, or replace "64" with "32"
Local_cflags + =-M32
Local_ldflags + =-M32
Then
In./build/CORE/Main. mk
Ifneq (64, $ (findstring 64, $ (build_arch )))
Changed:
Ifneq (i686, $ (findstring i686, $ (build_arch )))

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.