O'Reilly logo

Android NDK Beginner's Guide by Sylvain Ratabouil

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – creating a hybrid Java/C/C++ project

To check whether Eclipse compilation works fine, let's introduce surreptitiously an error inside the com_myproject_MyActivity.c file. For example:

#include "com_myproject_MyActivity.h"

private static final String = "An error here!";

JNIEXPORT jstring Java_com_myproject_MyActivity_getMyData
...

Now, let's compile MyProject with Eclipse:

  1. Open menu File | New | Other....
  2. Under C/C++, select Convert to a C/C++ Project and click on Next.
  3. Check MyProject, choose MakeFile project and Other Toolchain and finally click on Finish.
  4. Open C/C++ perspective when requested.
  5. Right-click on MyProject in Project explorer view and select Properties.
  6. In the C/C++ Build section, uncheck Use default build command and enter ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required