CentOS Linux system building Android development environment

  • 2020-05-13 04:27:24
  • OfStack

CentOS Linux system building Android development environment

Many people develop Android under Windows, but for Linux and Android, there is little information about the development environment. Today, I found the process of building Android development environment in CentOS Linux system Shared by a netizen on the Internet. The following is a detailed description of the configuration steps:

Since I recently used CentOS 5.5 every day, I chose CentOS 5.5 as my development environment.

It mainly includes the following steps:

1. Installation of JDK
2. Installation of Eclipse
3. Installation of ADT
4. Install Android SDK
5. Installation of Android NDK

1. Installation of JDK

Instead of using the Java environment that comes with CentOS, download java, the latest version of Oracle, at

http://www.oracle.com/technetwork/java/javase/downloads/jdk6-jsp-136632.html

Directly Download, then jump to the page and select Linux in Platform to download, I did not register, directly click Continue to enter the next page, select the type of package you want to download, I choose

bin will be down in a minute if the Internet speed is fast.

Modify executable permissions after download:

# chmod + x jdk u21 4-6 linux - i586 - rpm. bin

Then execute it:

#./jdk-6u1-linux-i586-rpm.bin

Some options may appear in the process, yes direct.

After installation, the configuration environment variable program is installed under /usr/java by default.

Note: in the case of multiple entries, the semicolon is used under windows; Separated, but linux under the colon:.

# vim/etc/profile

Add the following at the end of the file:


 export JAVA_HOME=/usr/java/jdk1.6.0_21 
  export JAVA_BIN=/usr/java/jdk1.6.0_21/bin 
  export PATH=$PATH:$JAVA_HOME/bin 
  export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar 
  export JAVA_HOME JAVA_BIN PATH CLASSPATH

View java version after completion:


  # java -version

  Java(TM) SE Runtime Environment (build 1.6.0_21-b06) 
  Java HotSpot(TM) Server VM (build 17.0-b16, mixed mode) 

Now that the Java environment is configured, go ahead and install IDE. eclipse is recommended for Google.

2. Installation of Eclipse

I am also new to eclipse, which is also the latest version of Eclipse (Helios).

Eclipse download: http: / / www eclipse. org/downloads /

Eclipse IDE for Java Developers, 98 MB Linux 32 Bit

Anyone who has ever used java will know that eclipse is a green version and can be used when unzipped. After double-clicking the eclipse files in the eclipse folder, eclipse IDE for Java Dvelopers will be run. If you're familiar with it, you can set workspace, and then you can turn off the welcome screen and go into the development environment.

I put Eclipse under /home/Android/, and then I put everything I need under it.

3. Installation of ADT

ADT version: ADT 0.9.7 (May 2010) Android development tool

(1) use Eclipse's upgrade manager to install ADT:

1. Start Eclipse and enter Help > Install New Software.

2. In the Available Software dialog, click Add... .

3. A Add Site dialog box, enter 1 in Name domain name (for example, "Android Plugin"), in "Location" domain input URL: https: / / dl - ssl. google. com/android eclipse /.

4. Note: if there is a problem, you can replace https with http and try 1. Click OK.

5. Go back to Available Software and you should see "Developer Tools". Select checkbox. Click Next, accept license agreement, and then click Finish.

6. Restart Eclipse.

(2) manually install ADT and download ADT.

ADT 0.9.7 http://dl.google.com/android/ADT-0.9.7.zip

After downloading, unzip the file and copy it to the eclipse directory.

You can also put Help as above > Install New Software. The installation address points to the ADT folder after unzipping.

4. Installation of Android SDK

Download Android SDK core packages for Linux version http: / / dl - ssl google. com android/repository _r01 / android - 2.2 - linux. zip.

It is important to note that the zip package is not a complete package. The Android software package is in the form of "components", which users can select according to their needs. The zip file above contains only one component management tool and one basic tool component.

Let's configure the ADT that we have installed above. Configure ADT in Eclipse to point to Android SDK.

1. Select Eclipse Window > Preferences...

2. Select Android

3. Click Browse... Locate the Android SDK directory. For example, my directory: /home/Android/ android-sdk-linux_86

4. Click Apply, then OK.

The development environment is basically set up, but let's upgrade and download a few things to download the full SDK. There are many update packages, including the Doc documentation, the Samples sample code, and the SDK file. The whole process will download and install automatically:

1. Run Eclipse and select Window > Android SDK and AVD Manager.

2. Select Installed Packages in the left panel

3. Click Update All and the Choose Packages to Install dialog will appear. Select Accept All and click Install. About 1.4GB capacity. If there is no problem with the Internet, it will be done at night.

4. Create AVD

In order for the Android application to run on the emulator, AVD must be created.

(1) in Eclipse. Choose Windows > Android SDK and AVD Manager

(2) click Virtual Devices on the left panel, and then click New on the right

(3) fill in Name, and select API of Target, SD Card of any size, Skin of any size, Hardware currently remains the default value

(4) click Create AVD to create AVD

Read 1 some data, now the development is based on 1.6 development. In the future, you only need to compile in the version, I have not tried

5. Install Android NDK

Some Java developers have abandoned procedural languages like C1. Compared with the open source projects of Android, the C world has accumulated many open source projects that can be reused (including many famous games such as Quake and DOOM). The parts of the execution efficiency that involve a lot of mathematics can also be considered to be completed by C.

Consider developing C/C++ applications that may require integration with Eclipse CDT. CDT, Eclipse C/C + + environment, online installation address http: / / download eclipse. org tools/cdt/releases/galileo. You can download it and install it manually, as I described above.

1. Start Eclipse and enter Help > Install New Software.

2. In the Available Software dialog box, click Add...

3. Add the unzipped folder address - > After selecting local, select ok. Then select the required content for the installation.

After running an example project of NDK, I found that CDT is not necessary. I think it may be used in the future, or integrated QT development environment.

NDK download address: http: / / dl google. com android/ndk/android - ndk - r4b - linux - x86. zip

The installation of NDK is very simple, that is, unzip the downloaded package to the specified location. After unzip, we usually need to configure environment variables. Here, we put the configuration of environment variables in the last 1 to configure.

Unzip location: /home/Android/ android-NDK-r4b


 #vim /etc/profile 
  #set NDK env

  NDKROOT=/home/Android/android-ndk-r4b

  export PATH=$NDKROOT:$PATH

NDK needs to be configured to HelloJin. Classic Hello ~ create Android project import to exist source.

Open hello-jni project properties, select builder, select program, and click OK.

The configuration is as follows, NDK_Builder, location and working directory

/ usr/bin/bash and/usr/bin

arguments to your project directory 1.

My arguments is: - login - c "cd home/Android/android - ndk - r4b/samples/hello - jni && $NDKROOT/ndk - build"

When you're done, you can run it.

If you are using the CentOS Linux system, this is where you can start Android development.

Thank you for reading, I hope to help you, thank you for your support of this site!


Related articles: