Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get started with Android Studio C++ development

I heard at Google I/O 15 that Android Studio has now C++ support, the official documentation for the NDK only has instructions for Eclipse.

How does one get started with Android C++ development using Android Studio?

like image 399
proppy Avatar asked Aug 21 '15 23:08

proppy


People also ask

Can I use C for Android development?

The Android Native Development Kit (NDK): a toolset that allows you to use C and C++ code with Android, and provides platform libraries that allow you to manage native activities and access physical device components, such as sensors and touch input.

Can I develop app using C?

3. C++ C++ can be used for Android App Development using the Android Native Development Kit(NDK).

Is C# good for Android development?

On Android, C# performs better than Java both because of language design choices (support for value types, real generic types, non-virtual method defaults) and the more mature Mono runtime compared to the relatively young Dalvik.


1 Answers

There is detailed instructions on the Android NDK Preview site.

The gist of it

  • Download Android Studio 1.3+
  • Install the NDK bundle from Tools > Android > SDK Manager NDK in android sdk manager
  • Import the hello-jn sample using File > Import Sample (Note: This sample is using the new gradle-experimental plugin) import sample diaglog
  • Click Run > Edit Configurations... and andd a new Android Native configuration native run configuration
    (source: android.com)

  • Run and debug your application as usual

A few things to try from there:

  • Generate JNI bindings for Native Java function. generate jni binding
  • Put breakpoint in native code (with the current limitation that breakpoint on init/onCreate get skipped, should be already fixed in Android Studio 1.4 Preview)
  • Give feedback to the team
  • Try and contribute to the new sample on GitHub
  • Explore the new documentation and API reference.
like image 53
proppy Avatar answered Sep 29 '22 23:09

proppy