Android compilation process on Ubuntu

Source: Internet
Author: User

Android source code download official website is: http://source.android.com
Source code download instructions page is: http://source.android.com/download

In fact, good English friends don't have to look at me here, even if I am here, simply follow Google's instructions. Everything is very simple.

Next we will summarize the download and compilation processes of Android platform on slackware 12.0:

(1) Of course, you need to install slackware 12.0 or a later version of Linux, and select "full" Mode for full installation.

(2) check whether the environment meets the requirements. You can create an account under Linux and check whether the following requirements are met in the account directory:
A) git (version 1.5.4 or later, slackware 12.0 itself is 1.5.5)
B) Python (2.4 or later versions, slackware 12.0 should be 2.5)
C) For Versions later than jdk5.0, this slackware 12.0 does not exist. slackware only has a Java Runtime Environment, so log on:
Http://java.sun.com/javase/downloads
Download one. I downloaded the jdk5.0 Update 10 version. Theoretically, the higher the version, the better.
Then, run chmod A + x jdkxxxxxxx. Bin and install it on your machine.
(Note: Of course, you can also directly Su to root to get the installation package under the/usr/local directory)

Then, you need to pay attention to the following network settings:
/Usr/local/JDK-xxxxxxx/bin/controlpanel
Select setting in the network and set the connection type to direct connection.

(3) create a working directory, enter the working directory, and create the bin directory:
Mkdir ~ /Works
Mkdir ~ /Works/android_dev
Cd ~ /Works/android_dev

Mkdir Bin

(4) download and install the repo version management tool
Curl http://android.git.kernel.org/repo> ~ /Works/android_dev/bin/Repo
CD Bin
Chmod A + x Repo

(5) Start preparing to download android
Cd ~ /Works/android_dev
./Bin/repo init-u git: // android.git.kernel.org/platform/manifest.git
Generally, an error is prompted (if you have not created a repo account before). Ignore this error.

(6) configure a repo account
Git config -- global user. Email "[email = XXXXX @ xxxxxxx] XXXXX @ xxxxxxx [/Email]"
Git config -- global user. Name "xxxxxx"

(7) download the source code of Android platform
Repo sync
This operation will last for a period of time, and the network speed will be reached. The source code mentioned above by Google occupies 2G hard disk space, but it does not seem to be that large, only about M.

(8) Now, prepare the environment variables.
It is best to add the environment variable definition in. bashrc or the/etc/profile file:
Export android_java_home = $ java_home
Logout is required, login again, and then use:
Echo $ android_java_home
Command to check whether the environment variable has taken effect

(9) modify a small "bug"
In theory, you can directly start compiling on Ubuntu, but it seems that you still need to manually modify a bug in the compilation script on slackware. Find the following file:
~ /Works/android_dev/external/SQLite/Dist/Android. mk
Find the following line:

Ifneq ($ (Strip $ (have_readline )),)
Local_ldlibs + =-lreadline
Endif

There is only one-lreadline, which is not enough for slackware. libreadline. So: undefinedreference 'pc' and other errors will occur during compilation. The correction method is very simple, that is, adding-lncurses to the end of this sentence. After correction, it should look like this:
Local_ldlibs + =-lreadline-lncurses
Okay, then you can start to let go of compilation.
(10) Compile
Make
Okay, then you can go out and have a cup of coffee (enough for a lot of coffee ).
After compilation, you will find that there is an additional directory under the Code directory:
~ /Works/android_dev/out
This is the generated result. Do not worry. You need to first set the environment variable method to the same as (8 ):
Export android_product_out =/home/Wayne/Works/android_dev/out/target/product/generic
After the configuration is complete, logout is required and login is used again to update the environment variables.
(11) start verifying the generated results
Go to the android_dev/out/host/bin/directory and run:
Emulator -- debug-init-skin QVGA-L [Press enter]
You should see the following figure (when you enable it for the first time, there should be a dialog box for feedback to Google, and press OK ):
{
Function onmouseover ()
{
Function onmouseover ()
{
Function anonymous ()
{
Showmenu (this. ID, 0, 1)
}
}
}
} "Id =" attach_782 ">

A.png(159.76 KB)

Congratulations! Haha, basically it has been compiled. To compile the version that can be run on the arm board, you still need to fix the android compilation script. The specific operation is not here.

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.