Native C++ Android project template
We begin the development cycle by showing you what to select in your Android Studio options. Below is a step by step instruction on what you need to do.
- Start by creating a project using the Native C++ Project Template as referenced the in the following screenshot.
- Set the application name to Neon Intrinsics, selected Java as the language, and set the minimum SDK to API 19: Android 4.4 (KitKat) as shown in the following screenshot.
- Select Toolchain Default for the C++ Standard as shown in the following screenshot.
The project that you created comprises one activity that is implemented within the
MainActivity class, deriving from
AppCompatActivity which you can see at app/java/com.example.neonintrinsics/MainActivity.java for further information. The associated view contains only a
TextView control that displays the string: “Hello from C++, as you can see in the following image:
To get these results, run the project directly from Android Studio using one of the emulators. To build the project successfully
- You must install
CMakealong with the Android NDK. You can do this through File > Settings. Then select NDK and CMake on the SDK Tools tab.
MainActivity.java file. The string that is displayed in the app comes from
native-lib. The code for this library is in the
app/cpp/native-lib.cpp file. That file is used for the implementation.