Sequoyah/ndk checklist

From Eclipsepedia

Jump to: navigation, search

Readme first

  • It would be very very nice if you perform these tests on all supported operating systems.
  • This is a guideline, created to avoid that the tester forget any feature. As a guideline it is simple and do not cover details. Please, use your creativity to make the testing more funny and efficient.
  • Configure the environment carefully according to the instructions of this document, it’s a little tricky and mistakes on the environment configuration may lead to false positives on the tests.
  • For now, the native development support is for Android only.


Pre-requirements

For the native support to work, you must (notice that the order matters):

  • Install CDT (version 7 or bigger) on your Eclipse

http://www.eclipse.org/cdt/

  • Install the Sequoyah Android feature on your Eclipse.

http://www.eclipse.org/sequoyah/

  • Download the Android NDK

http://developer.android.com/intl/de/sdk/ndk/index.html

  • If you’re using Windows, you also need the Cygwin

http://www.cygwin.com/

  • Install the Java Development Kit
  • On Windows, you also need the Cygwin with the following packages: GCC, G++, Make e Gawk (besides the standard ones)

http://www.cygwin.com/

Note: you need to add Cygwin\bin and ndk locations as first entries in your's machine PATH.



Configuration

1. Your system path (not the Eclipse path) should contain both locations for:

  • the Cygwin binary files (if windows), and
  • the NDK location.

Note: If you are using a Mac, double-check that you really set the system path correctly; it’s not as straightforward as with Windows.

2. Set the NDK location in the Android NDK preference page of your Eclipse.

3. Set de JDK in the preferences (Java > Installed JREs > Add).


Testing

Build or export your packages normally and they will contain the native library (right now there is an issue with the build process being fixed).

First of all, create an Android project in your workspace.

Below you have a basic checklist that can be used as a guideline to test all Native Development Support features.


What to test

1. Test the Add Native Support feature.

Right click the Android project and then go android tools > add native support. In the next page, set the Android NDK location and provide the name of the library and click finish.


  • A build must occur (gcc commands, but not necessarily creating objects). You can see it in the console
  • The Eclipse suggest that you change Android Native Perspective
  • Some folders are created (if they do not exist yet): JNI and Libs.
  • Make files are created.
  • A cpp file with the same name as the lib is created.


2. Test the templates, via start writing the following and pressing control+space:

  • native
  • load

For both keywords you should see suggestions of code.


3. Test the Automatic Code Generation feature, via:

  • Create a native method (for instance using the native template) somewhere in your java class (where you would create an ordinary Java method).
  • Call this method somewhere from your Java code.
  • Right click the java file that contains the native call and then go Source > Generate C files from Java.

A cpp file is created, named with the same name as the java class (complete name, with package name included) and it contains the c skeleton of the methods ready to be filled.


4. Test the Build feature (ordinary Eclipse build invocation).

The build should run normally; as a result it should the let the project ready to be exported (with all C++ and Java files properly compiled).