Download Android code in Ubuntu
1. Install Git and Repo
First, make sure to create a/bin directory under the current user's home directory (if not), and then put it (~ /Bin) to the path environment variable.
Www.bkjia.com @ ubuntu :~ $ Vim. bashrc Add:
Export PATH = $ PATH :~ /Bin
Www.bkjia.com @ ubuntu :~ $ Source. bashrc
Www.bkjia.com @ ubuntu :~ $ Echo $ PATH/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games: /home/a/bin www.bkjia.com @ ubuntu :~ $ Sudo apt-get install git-core
Www.bkjia.com @ ubuntu :~ $ Sudo apt-get install curl
These two commands install git-core and curl from the software repository on the Internet. Curl is a File Transfer tool that uses the URL syntax to work in the command line mode. It supports many protocols, including FTP, FTPS, HTTP, HTTPS, and TELENT, we need to install it to obtain the Repo script file from the network.
For android2.3.3, you can obtain the following information:
@ Ubuntu :~ $ Curl http://android.git.kernel.org/repo> ~ /Bin/repo
For android4.1, you can obtain:
Wget https://dl-ssl.google.com/dl/googlesource/git-repo/repo
This command downloads the repo script file to the bin directory of the current home directory and saves it in the file repo. Finally, we need to grant the repo file executable permissions www.bkjia.com @ ubuntu :~ $ Sudo chmod a + x/home/a/bin/repo
Next, we can use the repo script, Git, and curl software to obtain the Android source code.
However, in many cases, you may not be able to download it at all. The following lists some problems and solutions:
Www.bkjia.com @ ubuntu :~ $ Cat/etc/issue
Ubuntu 12.04.2 LTS \ n \ l
Www.bkjia.com @ ubuntu :~ $ Sudo lsb_release-
[Sudo] password for jianguoliao:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04.2 LTS
Release: 12.04
Codename: precise
Www.bkjia.com @ ubuntu :~ $
Run the above command to check your ubuntu version: 12.04
1. Check whether the system is 32-bit or 64-bit.
Www.bkjia.com @ ubuntu :~ $ Getconf LONG_BIT
32
Www.bkjia.com @ ubuntu :~ $ Getconf WORD_BIT
32
Www.bkjia.com @ ubuntu :~ $ File/bin/ls
/Bin/ls: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, buildID [sha1] = 0xae048fd2a071afcb017d9091f4a78835e27340b2, stripped
Www.bkjia.com @ ubuntu :~ $
Www.bkjia.com @ ubuntu :~ $
Www.bkjia.com @ ubuntu :~ $
Www.bkjia.com @ ubuntu :~ $ Uname-m
I686
Uname-m if i386 i686 i586 appears, it is 32-bit. If amd64 appears, it is a 64-bit system.
2. Install jdk1.6
Solution 1: errors may occur.
Installing the JDK
--------------------------------------------------------------------------------
The Sun JDK is no longer in Ubuntu's main package repository. In order to download it, you need to add the appropriate repository and indicate to the system which JDK shoshould be used.
Java 6: for Gingerbread and newer
$ Sudo add-apt-repository "deb http://archive.canonical.com/lucid partner"
$ Sudo apt-get update
$ Sudo apt-get install sun-java6-jdk
The following error may occur;
Www.bkjia.com @ ubuntu :~ $ Sudo apt-get install sun-java6-jdk
Reading the package list... complete
Analyzing the dependency tree of the software package
Reading status information... complete
There is no available package sun-java6-jdk now, but it is referenced by other packages.
This may mean that the missing software package may have been deprecated,
Or it can only be found in other release sources
E: the package sun-java6-jdk does not have candidates for Installation
Solution 2: We recommend that you use the following method. In ubuntu 12.04, the first method used on the 64-bit official website is not successful.
Sudo gedit/etc/apt/sources. list
Open source list, add
Deb http://us.archive.ubuntu.com/ubuntu/ hard multiverse save exit.
2. sudo apt-get update
3. sudo apt-get install sun-java6-jdk
4. www.bkjia.com @ ubuntu :~ $ Sudo update-alternatives -- config java
There is only one alternative in link group java:/usr/lib/jvm/java-6-sun/jre/bin/java
Nothing to configure.
5. www.bkjia.com @ ubuntu :~ $ Java-version
Java version "1.6.0 _ 06"
Java (TM) SE Runtime Environment (build 1.6.0 _ 06-b02)
Java HotSpot (TM) Server VM (build 10.0-b22, mixed mode)
Www.bkjia.com @ ubuntu :~ $
Installing required packages (Ubuntu 12.04)
--------------------------------------------------------------------------------
Building on Ubuntu 12.04 is currently only experimentally supported and is notguaranteed to work on branches other than master.
$ Sudo apt-get install git gnupg flex bison gperf build-essential \
Zip curl libc6-dev libncurses5-dev: i386 x11proto-core-dev \
Libx11-dev: i386 libreadline6-dev: i386 libgl1-mesa-glx: i386 \
Libgl1-mesa-dev g ++-multilib mingw32 tofrodos \
Python-markdown libxml2-utils xsltproc zlib1g-dev: i386
$ Sudo ln-s/usr/lib/i386-linux-gnu/mesa/libGL. so.1/usr/lib/i386-linux-gnu/libGL. so
3. Install git
Sudo apt-get install git-core curl
This command installs git-core and curl from the software repository on the Internet.
4,
Installing Repo
--------------------------------------------------------------------------------
Make sure you have a bin/directory in your home directory and that it is stored in your path:
$ Mkdir ~ /Bin
$ PATH = ~ /Bin: $ PATH
Download the Repo tool and ensure that it is executable:
$ Curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo> ~ /Bin/repo
$ Chmod a + x ~ /Bin/repo
Where
Www.bkjia.com @ ubuntu :~ $ Curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo> ~ /Bin/repo
% Total % Received % Xferd Average Speed Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 --: -- 0:04:00 --: -- 0 curl: (7) Failed to connect to 2404: 6800: 4005: c00: 88: network is unreachable