Android SDK + eclipse + ADT + CDT + ndk Development Environment built in Windows 7

Source: Internet
Author: User

Address: http://www.cnblogs.com/colife/articles/2046684.html

Android SDK + eclipse + ADT + CDT + ndk Development Environment built in Windows 7

I have been studying how to build the android sdk c/C ++ platform over the past few days. Although I have successfully built the android SDK in Windows XP, it took a lot of time because I didn't leave any useful records, write it out today for future use. Because Android SDK and eclipse are both written in Java
7 install JDK, in order to carry out subsequent operations,: http://www.oracle.com/technetwork/java/javase/downloads/index.html select the corresponding Version Download installation.

The establishment of the platform can be divided into two major steps:

1. First, build the android SDK + eclipse + ADT environment. This is a lot of introduction on the network and will not cause any problems step by step. Here is a brief introduction:

1, install Android SDK package, here is: http://developer.android.com/sdk/index.html the website has been harmonious, domestic friends may need to flip the wall, pay attention to download the corresponding version when downloading.

2. Find the SDK manager to start in the program directory installed in the previous step. On the main interface of Android SDK and AVD manager, select available packages ", click the ">" icon in front of Android repository to expand the options. Select Android SDK platform-tools and revision
2. SDK platform Android 2.3.1, API 9, Revision 2, samples for sdk api 9, and revision 1 in the preceding dialog box, click "Install selected, in the pop-up choose packages to install dialog box, select "accept all" and click "Install" to go To the download process. The download speed depends on your network speed, please wait for the download to be completed. After the download is complete, the dialog box asking whether to restart ADB is displayed. Click Yes.
Restart. Create an android simulator and click "New... "button to bring up the" Create New androidvirtual device (AVD) "dialog box, enter Android-AVD in name, and select Android 2.3.1-API level 9 in target, SD card input 512,
For other options, the default value is "create AVD". The Android simulator window will pop up after a moment.

3, install eclipse integrated development environment, visit the following address download Eclipse: http://www.eclipse.org/downloads/ select the corresponding Version Download select Eclipse IDE for Java developers version.

4. Install the android development tools plug-in. Visit http://developer.android.com/sdk/eclipse-adt.html#installingand find it on the webpage.
ADT
Download it, and decompress it to the eclipse directory to complete installation.

5. Configure eclipse. On the eclipse main interface, click the window menu and select preferences. In the preferences dialog box, select "android" on the left and click the Brower button on the right side of the SDK location, select the SDK installation path
.

Now we can create an android project in eclipse. Next we will create an android project hellomini6410 to verify whether the development environment is successfully set up. On the eclipse main interface, choose File> New> project..., as shown in the following figure:
In the "project" dialog box, select "Android-> Android Project", and click "Next". The "new Android project" dialog box is displayed. Enter the following information in the dialog box:
1) Enter hellomini6410 in project name
2) Select the check box Android 2.3.1 in build target.
3) Input hellomini6410 in APPICATION name
4) Enter com. mini6410 in package name.
5) Input mainactivity in create Activity
As shown in, after entering the information, click the "finish" button to complete the new project wizard and return to the main interface: Click X after welcome to close the welcome page. The project view will be started, click Src-> COM. mini6410-> mainactivity. you can see the source code in Java: To compile and run the hellomini6410 program, first in package
Select the hellomini6410 project name in explorer, and click Run> Run as> Android Application in the toolbar. The android simulator will be automatically started. Because the Android system needs to be started, you have to wait patiently. After the Android system is started, it will automatically run
Hellomini6410 program.

Now, you can develop Java-based applications under Eclipse IDE. The next step is to introduce how to add C/C ++ functions in Eclipse IDE, which is also the focus of this article.

2. Create an android ndk development environment.

To develop ndk on Windows, cygwin (a software simulating Linux on Windows) needs to be installed. cygwin installation is complicated. If it is the first installation, it may not succeed, refer to the relevant article here to only give it: http://www.cygwin.com/

1, install Android ndk, can download to Android Official Website: http://developer.android.com/sdk/ndk/index.html
Select the desired version to download and decompress it.

2. Configure cygwin and use utriaedit to open the home/<your username>/. Bach-profile file in the cygwin installation directory.
Ndk =/cygdrive/<ndk installation path>
Export ndk
You can also add the environment variable $ ndk = <ndk installation path> in windows.

3. Install the CDT plug-in. CDT is a plug-in that enables eclipse to support C/C ++. This is: http://www.eclipse.org/cdt/downloads.php
You can install it in help> install new software in eclipse. Now, go to help-
Install new software menu item, add: CDT-http://download.eclipse.org/tools/cdt/releases/helios, wait for the update project tree to load, and then select Programming
Eclipse C/C ++ development tools under the ages branch, and then click Next. Follow the prompts below to accept the default options, and finally accept the license, so that eclipse can complete the update. After that, you will see a prompt asking you to restart eclipse. Click "yes" and wait for eclipse to restart. Now your eclipse supports C/C ++.

4. Eclipse Configuration

Right click on your project, pick properties.
Select "builders" from the left-hand list.
Click "new..." on the right side.
Select "program" as the configuration type.
I name mine "Native builder"
Location-c: \ cygwin \ bin \ bash.exe
Working directory-c: \ cygwin \ bin
Arguments-
(For ndk R3 ):
-- Login-c "CD/cygdrive/C/android_ndk & make APP = MyApp"
(For ndk R4 ):
-- Login-c "CD/cygdrive/C/<myapp_project_dir> &/cygdrive/C/android_ndk/ndk-build"
Make sure you have the two hyphens before login and the quotes after the hyphen-C
Now go to the refresh Tab
Check "Refresh resources upon completion"
Select "specific resources"
Click on the "specify resources" button and select your project's lib directory.
Check "recursively include sub-Folders"
Now go to the build options Tab
Check "allocate console"
Check "launch in background"
Check "run the builder after a clean"
Check "run the builder during manual builds"
Check "run the builder during auto builds"
Check "specify working set of relevant resources"
Click on "specify resources"
Select your project's JNI directory and all files.
Now click OK on the bottom.

The above is its detailed configuration from: http://www.rbgrn.net/content/348-get-your-eclipse-integrated-ndk-on
Now you can compile and run the C/C ++ program in Eclipse IDE.

Now compile and run the hellomini6410 program again. First, select the hellomini6410 project name in package explorer.
Click "run"> "Run as"> "Android Application" in the toolbar. The simulator runs successfully.

Several Problems encountered:

1. the following error occurs when installing CDT:
Cannot complete the install because one or more required items cocould not be found.
Software being installed: Eclipse C/C ++ Remote launch 6.0.0.201002161416 (Org. Eclipse. CDT. Launch. Remote. feature. Group 6.0.0.201002161416)
Missing requirement: Eclipse C/C ++ Remote launch 6.0.0.201002161416 (Org. eclipse. CDT. launch. remote. feature. group 6.0.0.201002161416) requires 'org. eclipse. RSE. ui [3.0.0, 4.0.0) 'But it cocould not be found
Solution: Download C/C ++ eclipse and copy all the jar files under the plugin directory to the plugin directory in the eclipse installation directory of the Java version, during replication, note that if an existing one exists, the problem of re-installing the CDT will not occur. The reason for this is unclear.


References:

1. Installing the SDK http://developer.android.com/sdk/installing.html
2. Download the android ndk http://developer.android.com/sdk/ndk/index.html
3. ADT plugin for eclipse http://developer.android.com/sdk/eclipse-adt.html
4. Get your eclipse-integrated ndk on! Http://www.rbgrn.net/content/348-get-your-eclipse-integrated-ndk-on
Android beginners: ndk setup step by step http://mindtherobot.com/blog/452/android-beginners-ndk-setup-step-by-step/

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.