Android build toolchain
Introduction
This page outlines what is required to build a Scapi plugin to be installed and run with Trimble Access on an Android device.
Development still occurs on a Windows machine using Microsoft Visual Studio.
Android requires the same development setup as used internally at Trimble for TA - MSVC 2019 or 2022, Android NDK etc.
If your plugin uses QImage or any other Qt component, then QT 5.15.14 (or whatever is latest) would need to be installed. This is discouraged.
To get set up, follow the steps below.
Note: For Trimble internal developers - see the Survey group Wiki for setup instructions. Once you are set up for building TA, plugins should build without further work.
There is a Trimble Access Android Plugin.zip which is a project template in the SDK which, along with the Windows project template, is installed into this directory (or its equivalent for VS 2022 etc):
C:\Users\<user>\Documents\Visual Studio 2019\Templates\ProjectTemplates\Visual C++ Project\
There may be multiple versions; choose the one to support the required versions of Trimble Access, remembering that any version will be binary compatible with later versions of Trimble Access.
Installation
This guide assumes you already have Trimble Access and the Scapi SDK installed, along with Microsoft Visual Studio 2022 (or 2019). If not, please see Setting up the development environment. Getting your plugin working with Windows is a good way to streamline setting up for Android.
Install The Android SDK
The version of the Android Native Development Kit (NDK) is required for installation. Look on the Scapi Home page for a table listing the NDK version required for each release of Trimble Access. You can install multiple versions.
Obtain the sdkmanager by downloading the latest SDK command line tools from this web page (about 3/4 of the way down the page under the heading Command line tools only) and unzipping the file.
Then run the following commands, substituting the italicised parts for the version required.
sdkmanager "ndk;26.1.10909125"
sdkmanager "platforms;android-29"
Next, in the plugin project, edit PropertySheets\AndroidEnv.props and set the PropertyGroup to something like the following, but substitute the paths for the correct ones for your installation of the Android SDK and NDK.
<PropertyGroup Label="UserMacros">
<ANDROID_SDK_ROOT Condition="'$(ANDROID_SDK_ROOT)'==''">C:\AndroidSDK</ANDROID_SDK_ROOT>
<ANDROID_NDK_ROOT Condition="'$(ANDROID_NDK_ROOT)'==''">C:\AndroidSDK\ndk\21.3.6528147</ANDROID_NDK_ROOT>