Configure Android source code in Ubuntu 13.04

Source: Internet
Author: User

A little experience.

Download and install Ubuntu13.04 and start the terminal.

1. Git

The Android source code is managed by git. Therefore, install git first:

Sudo apt-get install git-core gnupg

2. Because some other dependent packages need to be decompressed later, you may wish to prepare these dependent packages first. Here, libsdl-dev may provide updates. the version I see is 1. 2. in addition, libwxgtk2.8-dev will also provide updates. In short, if any updates are prompted, write the latest version. Sudo apt-get install flex bison gperf libsdl-dev libesd0-dev libwxgtk2.8-dev build-essential zip curl3.Java SDK has read a lot of instructions on using command configuration directly on the terminal before, but I did not test it. Two aspects of it, mostly still write sun-java6-jre and so on, but sun has been acquired by Oracle, if the direct update of flowers, probably oracl-java7-jre like this, because oracle seems to provide only java7 on the main line (not detailed), but android development is still written using java6. therefore, we can go to the official website of CMDL to find the old java jdk. There may be a need to register a user of oracle, and then agreed to some of the agreement, you can choose to download, here there are two types of packages, one is a 32-bit jdk-6u **-linux-i586.bin, one is a 64-bit jdk-6u **-The linux-x64.bin pays attention to your own system version, choose the right package to download. After the download, it is usually cut out in the main folder download, create a folder named JDK (random) in the main file, and paste it in. Start to operate cd/home/user/JDK on the terminal. user is your user name, And JDK is the name of the new folder. Chmod u + x jdk-6u **-The linux-i586 changes permissions, and the jdk below is the name of the jdk package you downloaded. Or write the chmod 701 jdk-6u **-linux-i586 sudo. /jdk-6u **-extract the linux-i586.bin, will prompt yes or no, write yes, or see the word more always press enter, in fact, is to let you see the protocol. After decompression, a folder similar to JDK 1.6.0 _ 45 is displayed in the JDK folder. Now you need to configure the java environment variables. Sudo gedit/etc/profile Add the following code after the proifle file:

# Set java environment

JAVA_HOME =/home/user/JDK/jdk1.6.0 _ 14

Export JRE_HOME =/home/user/JDK/jdk1.6.0 _ 14/jre

Export CLASSPATH = $ JAVA_HOME/lib: $ JRE_HOME/lib: $ CLASSPATH

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

 

Here, the user is your user name. jdk 1.6.0 _ 14 is the jdk folder that was just extracted. After adding the version, save it, restart the system, and enter java-version on the terminal to view the java version information. 4. Download the Android source code goolge provides a repo tool, which is actually a script file, which encapsulates the git commands required to download the Android source code. First download repo wget https://dl-ssl.google.com/dl/googlesource/git-repo/repochmod a + x reposudo mv repo/bin/after installing the repo, create a new empty folder, execute the repo command in it to download the android source code. Mkdir Androidcd Androidrepo init-u https://android.googlesource.com/platform/manifest-B android-2.3.1_r1 here the last line-B android-2.3.1_r1 is to download the android source code version number, you can not write, then directly download the latest source code on the main line, but the latest is the development version, there will always be some small problems, may wish to be a more mature version, the above is given 2.3.1, changed to android-4.0.1_r1 is 4.0.1 version. You can query the specific requirements before proceeding. Then execute repo sync to start synchronizing the android source code. Sometimes we may see a stuck phenomenon, that is, the data is not updated, and the whole is static. You can press ctrl + z to pause, and then repo sync on the input side will continue to be synchronized. Until the done keyword is displayed, the download is complete. 5. Android source code compilation can be directly compiled under files on 64-bit machines. ~ /Android $ make requires related files on 32-bit hosts. (1) Open the build/core/main. mk file and find the following content: Ifeq ($ (BUILD_ OS), linux)  Build_arch: = $ (shell uname-m) # Change the following line for building on a 32-bit system. # Ifneq (64, $ (findstring 64, $ (build_arch ))) $ (Warning ************************************* ***********************) $ (Warning You are attempting to build on a 32-bit system .) $ (Warning Only 64-bit build environments are supported beyond froyo/2.2 .)Change Row 3 Ifneq (i686, $ (findstring i686, $ (build_arch )))(2) Find the following files:/external/clearsilver/cgi/Android. mk/external/clearsilver/cs/Android. mk/external/clearsilver/java-jni/Android. mk/external/clearsilver/util/Android. mk modify the variables LOCAL_CFLAGS and LOCAL_LDFLAGS: # This forces a 64-bit build for Java6  # Change the following two lines for building on a 32-bit system. # LOCAL_CFLAGS + =-m64 # LOCAL_LDFLAGS + =-m64Change the last two rows LOCAL_CFLAGS + =-m32 LOCAL_LDFLAGS + =-m32Then make. There may be various errors. At this time, we need baidu & google to help. After the dinner is compiled, You can package it into sdk :~ /Android $ make sdk package, you can develop Android applications in the IDE environment. The above is my little experience.

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.