Skip to main content

CourierSampleApp

System Requirements

This document mandates adherence to the Android Application Development Environment 
Setup Guide, as a prerequisite for system compliance.

By following these steps, you should have a consistent and well-configured development environment for your Android application on Windows 10. Remember to restart your system after making changes related to CMake in Android Studio and after updating Environment Variables.

drawing-7-1706169567.png


Project Structure

NativeViewLibrary is using the Android Gradle Plugin Version 3.5.3 with Gradle Version 5.4.1. The
Application is tested with ndk-26 that can be installed from the document in chapter Configuration and System Requirements. The supported API range is 24-28. The supported ABIs are arm64-v8a, x86_64, x86. The NativeViewLibrary Android Application is using the NativeView library included in the Android Application. This NativeView Library will be moved out of the project directory in the next release and will be included from outside of the project as library.

Building and Running the Android Application

To be able to build and run the Android Application, the following steps must be done.

  1. Subst the root of CGI Studio.
    • Open a Command Prompt in the root of CGI Studio directory e.g., “...\cgistudio” and type: “subst
      x: .” and click enter.
  2. Open the Android Application in Android Studio from “X:\cgi_studio_apps\References\Android\CourierSampleApp”.
  3. Open the “local.properties.sample” file and change the “USERNAME” in the SDK and NDK path to match the
    system it will be used on.
  4. Copy the contents of the file to “local.properties”. Note that if the SDK or NDK paths do not exist, Android
    Studio will reset the “local.properties” again after trying to Sync Project with Gradle Files.
  5. Make sure the JDK is set to 11 in [File | Settings | Build, Execution, Deployment | Build Tools | Gradle]
    like described in chapter Java Development Kit (JDK).
  6. Set one of the supported ['arm64-v8a', 'x86_64', 'x86'] ABI in supportedABI of the “build.gradle (Project: Mpdule :app)”.
  7. Create an asset with CGI Studio for Android by running “X:\bin\SceneComposer\SceneComposer_Android_OpenGLES30.bat”, and then opening the following solution for CourierSampleApp from “X:\cgi_studio_courier_apps\src\CourierSampleApp\SCSolution\Android\Solution.scs” and save this as:
    1. AssetLibCff_CourierSampleApp.bin and then copy it into the /sdcard/ directory of the target/emulator. For the emulator this can be down in the "Device Explorer" of the emulator in Android Studio.
    2. AssetLibCff_Android_Target.bin and then copy it to “X:\cgi_studio_courier_apps\src\CourierSampleApp\Assets”. This one is needed to build the .so library required by the Android Project.
  8. Make sure the steps of "Alternative CMake Approach" have been done prior to the next step.
  9. Open CMake and choose "X:/cgi_studio_courier_apps/src/CourierSampleApp" as source code and e.g. X:/build for where to build the binaries. Click Configure.
  10. Specify "Ninja" as the generator for this project and choose "Specify toolchain file for cross-compiling". Click Next.
  11. Choose "X:/cgi_studio_devices/src/Android/ToolchainFiles/android.toolchain-ndk26-generic.cmake". Click Finish.
  12. The first "error" will ask to set the "ANDROID_ABI", choose the ABI required. This should match the target/emulator CPU Architecture. Click Configure.
  13. The next "error" will ask to set the ANDROID_PLATFORM. This should match the target/emulator Android version. Click Configure until there are no red lines anymore and then click on Generate.
  14. Open CMD and navigate to "X:/build" by typing first "x:" and clicking enter, and then "cd X:/build" and clicking enter.
  15. Type "ninja" and click enter for the build to start.
  16. After the build is done, copy "X:/build/libCourierSampleAppLib.so" to the directory matching the ABI previously selected e.g. "X:\cgi_studio_apps\References\Android\CourierSampleApp\app\native-libs\x86_64\libCourierSampleAppLib.so".
  17. Run the Application by selecting the target/emulator and clicking on “run app”.
  18. The first time the Application starts, it will request permissions. Click accept.
  19. After choosing the desired asset in the list, the solution should be running.

Troubleshooting

  • If encountering any issues during the setup, refer to the official documentation for Android Studio,
    CMake, and NDK for troubleshooting steps.
  • If you encounter any issues linked to outdated source code, reach out to the Android developers for
    assistance in implementing a resolution.
  • Check for updates regularly and keep your development environment components up to date.

Platform Tests

 
  • Emulator Pixel 2, x86_64, Android 6, API 23 (Without Play/APIs)
  • Emulator Medium Phone, x86_64, Android 9, API 28 (Without Play/APIs)
  • Emulator Pixel 2, x86, Android 9, API 28 (Without Play/APIs)