C++ Manual Tests

Project System Header Files

Simple test

  1. From Android Studio choose File/New/New Project...
  2. Click “Include C++ Support”
  3. Click through the wizard Next->Next->Basic Activity->Next->Next
  4. In Android project view open app/cpp/includes.

Expect to see ‘includes’ node

New Project Enhanced Includes

NOTE: On Windows the slashes in paths displayed should be back slashes.

Add a new user header file

  1. Right-click on cpp and choose New C/C++ Header File
  2. Name the new header file my-header-file.h

Expect to see ‘my-header-file.h’ node under cpp

New Project Enhanced Includes

NOTE: On Windows the slashes in paths displayed should be back slashes.

Endless Tunnel -- Viewing NDK sub components

  1. From Android Studio choose File/New/Import Sample...
  2. Type NDK and choose Endless Tunnel
  3. Open app/cpp/game/includes/NDK Components

Expect to see several sub-nodes under ‘NDK Components’ node

New Project Enhanced Includes

NOTE 1: On Windows the slashes in paths displayed should be back slashes.

NOTE 2: The exact content of the sub-nodes depends on the version of the NDK installed.

Viewing CDep sub components

  1. Clone this project from github: git clone https://github.com/jomof/cdep-android-studio-freetype-sample.git
  2. cd cdep-android-studio-freetype-sample
  3. On Mac/Linux ./cdep, on Windows cdep
  4. Open project File/Open.. choose /path/to/projects/cdep-android-studio-freetype-sample/build.gradle
  5. Open app/cpp/includes/CDep Packages

Expect to see two sub-nodes under ‘CDep Packages’ node: freetype and SDL

![New Project Enhanced Includes][res/cxx/enhanced-header-files/cdep-free-type-example.png]

CMake Version Pinning

Prepare C++ Project

  1. From Android Studio choose File/New/New Project...
  2. Select Native C++ from the wizard.
  3. Expect gradle sync to succeed without errors.

Pin and use Quick Fix to install CMake from SDK

  1. Use SDK Manager (Main/Preferences/Android SDK) to uninstall all CMake versions from SDK Tools.
  2. Edit the main module's build.gradle file and add android.externalNativeBuild.cmake.version "3.10.2".
  3. Click Sync now.
  4. Expect a gradle sync error with link: Install CMake 3.10.2. Click on the link.
  5. Expect installation to complete successfully. Click Finish.
  6. Expect gradle sync to automatically restart and succeed.

Verify the same behavior using version “3.10.2-rc2” and “3.10.2+”.

Pin and auto-install fork version from SDK

  1. Use SDK Manager (Main/Preferences/Android SDK) to uninstall all CMake versions from SDK Tools.
  2. Edit the main module's build.gradle file and add android.externalNativeBuild.cmake.version "3.6.0".
  3. Click Sync now.
  4. Expect CMake 3.6 to be auto-downloaded.
  5. Expect gradle sync to automatically restart and succeed.

Verify the same behavior using version “3.6.0-rc2” and “3.6.0+”.

Pin to non-existing version

  1. Use SDK Manager (Main/Preferences/Android SDK) to uninstall all CMake versions from SDK Tools.
  2. Edit the main module's build.gradle file and add android.externalNativeBuild.cmake.version "3.12.0".
  3. Expect a banner to appear at the top: Gradle files have changed since last project sync....
  4. Click Sync now.
  5. Expect a gradle sync error with the following message, and no link:
CMake '3.12' was not found in PATH or by cmake.dir property.
- CMake ... (these lines are not important)