Install the android compiling environment and compile the source code in ubuntu11.04

Source: Internet
Author: User

Statement: the source of HKUST is used. At first, the proxy is used to access the Internet. When the source is updated, a bunch of problems are encountered. Then, the source of Netease is used on the VPN, which is also a pair of errors during the update, it's okay to use the source of HKUST.

If the sun-java6-jdk cannot be installed, try adding a new source:

$sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"$sudo add-apt-repository "deb-src http://archive.canonical.com/ubuntu lucid partner"

The second message appears:

Error: 'deb-src http://archive.canonical.com/ lucid partner' invalid

Then install Java 6.

1. First install the java environment.

sudo apt-get install git-coresudo apt-get install gnupgsudo apt-get install flexsudo apt-get install bisonsudo apt-get install gperfsudo apt-get install libsdl-devsudo apt-get install libsdl-devsudo apt-get install libesd0-devsudo apt-get install build-essentialsudo apt-get install zipsudo apt-get install curlsudo apt-get install libncurses5-devsudo apt-get install zlib1g-dev

Note that the last one is the number 1.

Then

sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts sun-java6-jdk

Because the Java sdk of make sdkis bytes, install sun-java5-jdkand modify javadoc.1.gz and javadoc only, because only these two are used by make sdk. In this way, except for javadoc tool Version 1.5, all other tools use version 1.6.

First, add the source:

sudo add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/ hardy multiverse"sudo add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/ hardy-updates multiverse"

Run the following command:

sudo apt-get updatesudo apt-get install sun-java5-jdk

Modify the link of javadoc as follows:

cd /etc/alternativessudo rm javadoc.1.gzsudo ln -s /usr/lib/jvm/java-1.5.0-sun/man/man1/javadoc.1.gz javadoc.1.gzsudo rm javadocsudo ln -s /usr/lib/jvm/java-1.5.0-sun/bin/javadoc javadoc

Enter java-version to verify the configuration.

For Android development in linux, you also need to set environment variables:

vim ~/.bashrc

Then add or integrate PATH variables in bashrc, such as some environment variables related to java program development/running. The Code is as follows:

JAVA_HOME=/usr/lib/jvm/java-6-sunJRE_HOME=${JAVA_HOME}/jreexport ANDROID_JAVA_HOME=$JAVA_HOMEexport CLASSPATH=.:${JAVA_HOME}/lib:$JRE_HOME/lib:$CLASSPATHexport JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/binexport JAVA_HOME;export JRE_HOME;export CLASSPATH;HOME_BIN=~/bin/export PATH=${PATH}:${JAVA_PATH}:${JRE_PATH}:${HOME_BIN};#echo $PATH;

Do not forget to synchronize the above changes,

source ~/.bashrc

Now we have prepared the environment required for android source code development (no error). The process of downloading the source code is very huge because the Android source code needs to be obtained in two parts: Android source code and kernel. I don't need the source code of the kernel for the time being, so here I only download the source code.

I am using the root permission,

cdmkdir binmkdir sourcecd bincurl https://dl-ssl.google.com/dl/googlesource/git-repo/repo >rep

The following situations occur:

% Total % Received % Xferd Average Speed Time Current Dload Upload Total Spent Left Speed100 19731 100 19731 0 0 14034 0 0:00:01 0:00:01 --: -- 17157
If android.git.kernel.org is used, the following situations will occur:

 % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current                                 Dload  Upload   Total   Spent    Left  Speed100   244  100   244    0     0     75      0  0:00:03  0:00:03 --:--:--   976

During Compilation:

./Bin/repo: Line 1: The unexpected symbol 'newline' is near a syntax error./bin/repo: Line 1: '<! Doctype html public "-// IETF // dtd html 2.0 // EN">'

Continue now,

chmod a+x repocd ~/source../bin/repo init -u https://android.googlesource.com/platform/manifest -b android-2.3.3_r1

Enter the user name and email address in the middle. Just fill in one box.

After initialization

Repo initialized in root/source to start downloading:
../bin/repo sync

The following is a long wait.

error: Exited sync due to fetch errors

Run ../bin/repo sync again and then OK.

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.