Building an android development environment in Linux --- centos

Source: Internet
Author: User
Building an android development environment in Linux --- centos

I am also a newcomer to Linux. It takes about half a year to get Linux, and I am also a newcomer to the android team.
Since I recently used centos 5.5 every day, I chose centos5.5 as my development environment.
I used to dive in linuxsir for the first time. I wrote down my post carefully. At the same time, as my study notes, I will send my learning achievements.
As a newbie, if anything is wrong, I hope you will not give me any further advice and take care of it ~

Directory
1. Establish the environment
1.1 JDK Installation
1.2 install eclipse
1.3 ADT Installation
1.4 Android SDK Installation
1.5 install Android ndk

Content
1.1 JDK Installation
No centos built-in Java environment, download the latest version of Oracle Java, for the http://www.oracle.com/technetwork/ja...sp-136632.html
Directly download, go to the page and select Linux download in platform. I didn't register it. Click continue to go to the next page and select the type of the package you want to download.
Jdk-6u21-linux-i586-rpm.bin network speed faster, then it will be finished.
Modify executable permissions after the download is complete # chmod + x jdk-6u21-linux-i586-rpm.bin
Then execute it
#./Jdk-6u1-linux-i586-rpm.bin
Some options may appear in the process, direct Yes
Configure environment variables after installationProgramInstalled under/usr/Java by default
Note: In Windows, multiple values are separated by semicolons (;), but in Linux, the colon is used:

# Vim/etc/profile
Add the following content 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

Check the Java version later.

 
# Java-Version

Java (TM) se Runtime Environment (build 1.6.0 _ 21-b06)
Java hotspot (TM) server VM (build 17.0-f8, mixed mode)
After the Java environment is configured, install ide again. Eclipse is recommended for Google.
1.2 install eclipse
I am also a newbie, and of course everything is up to date. Eclipse also downloads the latest version of eclipse (Helios version ). Download eclipse
Http://www.eclipse.org/downloads/
Eclipse IDE for Java developers, 98 MB Linux 32 bit
People who have experience in Java Development basically know that eclipse is a green version and can be used after decompression. Double-click the eclipse file in the eclipse folder to run Eclipse IDE for Java dvelopers. You are familiar with it. Set up the workspace. You are welcome to turn off the interface and go to the development environment.
I put eclipse under/home/Android/, and I will put everything I need under it later.
1.3 ADT Installation
ADT version:
ADT 0.9.7 (May 2010) Android Development Tool

(1) Use the eclipse upgrade manager to install ADT:
1. Start eclipse and go to help> install new software.
2. In the available software dialog box, click Add ....
3. The add site dialog box appears, enter a name in the Name field (for example, "android plugin"), enter URL in the location field: https://dl-ssl.google.com/android/eclipse/
4. Note: If you have any questions, you can change HTTPS to HTTP. Click OK.
5. Return to the available software interface and you should see "Developer Tools ". Select checkbox. Click Next, accept the license agreement, and then click Finish.
6. Restart eclipse.
(2) manually install ADT and download the ADT. ADT 0.9.7 http://dl.google.com/android/ADT-0.9.7.zip
After the download is complete, decompress the package and copy the corresponding file to the corresponding eclipse directory ..
You can also point the help> install new software. installation address to the ADT folder after decompression, as shown in the preceding figure.
1.4 Android SDK Installation
Download the android SDK core package
For linux version http://dl-ssl.google.com/android/rep..._r01-linux.zip
You need to know that this zip package is not a complete package. The Android software package adopts the form of "components". You can select components as needed. The preceding ZIP file contains only one component management tool and one basic tool component.

.
Next we will configure the ADT installed above
Configure the ADT in eclipse to point it to the android SDK.
1. Select eclipse WINDOW> preferences...
2. Select android
3. Click Browse... to locate the android SDK directory. For example, my directory:/home/Android/android-sdk-linux_86
4. Click Apply and OK.
The development environment has been set up with the baseline, but we still need to upgrade and download some things and complete the SDK. There are many update packages, including the doc document, samples example Code And SDK files. The whole process will automatically download and install:
1. Run eclipse and select Window> Android SDK and AVD manager.
2. Select installed packages in the left-side navigation pane.
3. Click Update all.
The choose packages to install dialog appears. Select accept all and click Install
About 1.4gb capacity. If there is no problem with the internet, it will definitely be done in one night.
4. Create an AVD
To enable the Android Application to run on the simulator, you must create an AVD.
(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 the name and select the target API. the SD card is of any size and skin is selected. Currently, hardware retains the default value.
(4) Click Create AVD to create AVD.
After reading some materials, we have developed all of them based on 1.6. You only need to compile the version later. I have not tried it ~
1.5 install Android ndk
Some Java developers discard the Procedural language like C. Compared with open-source Android projects, the C world has accumulated many open-source projects available for reuse (including many famous games such as quake and doom ), in terms of execution efficiency, the part that involves a large number of mathematical operations can also be considered to be completed by C.

To develop C/C ++ programs, you may need to integrate eclipse CDT.
CDT, is eclipse C/C ++ environment, online installation address http://download.eclipse.org/tools/cdt/releases/galileo.

You can also manually install it after the download is complete, as I described above.
1. Start eclipse and go to help> install new software.2. In the available software dialog box, click Add ....
3. Add and decompress the folder address-> select local and click OK. Then select the required content for installation.
After running an ndk example project, I found that CDT is not necessary and may be used later, or integrated with the QT development environment.

Ndk: http://dl.google.com/android/ndk/and...-linux-x86.zip

The installation of ndk is very simple, that is, to extract the downloaded package to the specified location. After decompression, we usually need to configure the environment variable. Here we put the configuration of the Environment Variable together for configuration.

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

 
#Vim/etc/profile
#Set ndk env Ndkroot =/home/Android/android-ndk-r4b

Export Path = $ ndkroot: $ path

When compiling ndk, you also need to configure some, with hellojin. Very classic Hello ~ Create an android project and import it to the existing source.

Open the 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 must be consistent with your project directory.
My arguments is: -- login-c "CD/home/Android/android-ndk-r4b/samples/Hello-JNI & $ ndkroot/ndk-build"

After completion, you can run.

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.