Quantcast
Channel: Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1616

Eclipse* IDE: Using Android* Native Developer Kit (NDK) on OS X* Systems

$
0
0

This topic applies to Eclipse* for C/C++ on OS X* hosts for Android* targets.

You can automatically integrate the Intel® C++ Compiler that is part of the Intel® Integrated Native Developer Experience (Intel® INDE) into a preexisting Eclipse* CDT installation. If you have already installed the product you can integrate the Eclipse components separately using Eclipse Help > Install New Software menu item or by using the modify feature of the installer.

For more information on using Eclipse with the Intel® C++ Compiler refer to the User and Reference Guide for Intel® C++ Compiler > Getting Started > Using Eclipse* in this documentation. For information on which versions of Eclipse are supported refer to the Release Notes supplied with the product.

There are two approaches to building Android* applications with Eclipse* IDE:

  • Using the environment files and the -platform compiler option.

  • Using Android* Native Developer Kit plugin.

This topic describes how to configure Eclipse* IDE on OS X* host systems to build C/C++ applications for the Android* target platform using the Android Native Developer Kit (NDK). The Android NDK is a toolset that allows you to implement parts of your application using native-code languages such as C and C++. It is installed as part of Intel® INDE installation.

Follow these steps to configure Eclipse to use the Android* NDK plugin:

  1. Start Eclipse from /adt/eclipse folder.


  2. From the Eclipse ADT menu, select Preferences. The Preferences window opens.


  3. In the Preferences window, go to Android > NDK and enter the NDK path in the NDK Location text box.


  4. Click OK to close the Preferences window.

Now you must create a new project using one of the NDK samples and configure it to use native support.

  1. Create a new project from the NDK samples:

    1. From the Eclipse menu, select File > New > Project …. The New Project window opens.


    2. In the New Project window, select Android Project from Existing Code and click Next. The Import Project window opens.


    3. Browse to [ndk-dir]/samples/hello-jni directory, check the Copy projects into workspace checkbox, and click the Finish button.


      This will open the newly created project in the Project Explorer.


  2. With the new project loaded, you can configure the project to include native support (Java and C/C++ support).

    1. To add Native Support to the project, right-click on the project name in the Project Explorer window, select Android Tools > Add Native Support …


    2. A dialog opens asking for the Library Name. Set the library name to hello-jni as shown below:


    3. Click Finish to close the window.

  3. Create a new Application.mk file under jni folder with this line:

    APP_ABI:=x86

  4. Build the project. Right-click on project name and select Build Project.

  5. Test your application on any x86-based Android device including an x86-based Android Virtual Device (AVD).

Inglés

Viewing all articles
Browse latest Browse all 1616

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>