We provide you with an Android demo app to showcase 3 pipelines: fiducial and natural image marker-based pipelines and a SLAM.
SolAR Demo (Fiducial, Natural, SLAM) |
You will find the required markers for you to print on the link above. |
The SolAR framework uses a dedicated pipeline to link and compile code as well as internal tools for third party downloads which should make your job much easier. As you will see later, the SolAR framework is based on QMake originally created by the Qt Company, but compliant with most IDE.
Do not forget to install Qt Android component. SolAR supports arm64-v8a architecture only. |
It is recommended to install IDE for your own OS to test directly your pipeline on your system and then compile it for Android |
Once Qt Creator installed we can install dependencies required by Qt Creator for Android :
We recommend you to install these dependencies using Unity Android build support module (available from Unity HUB, see build support) Otherwise you can also directly download the dependencies in Qt Creator from SDKManager in Android tab of Tools>Options>Devices
|
You can find more information in Qt documentation : Android building
In Qt Creator navigation bar go to Tools > Options > Devices
.
Then fill required path and check if your Android kit is valid :
You need to configure your Remaken profile according to your development environment. To do so, run the following command in a command prompt:
remaken profile init --cpp-std 17 -b clang -o android -a arm64-v8a
You can check if the change have been done in your Remaken profile using :
remaken profile display
As we are using Conan to download dependencies, you need to configure a conan profile for Android. Remaken uses the following naming convention for the conan profile: os-compiler-arch. Thus, when Remaken calls conan install, it can pass the good profile to conan according to the targeted os, compiler and architecture. If you want to create a conan profile for android, with clang compiler and arm64_v8a architecture, run the following command:
conan profile new --force --detect android-clang-arm64-v8a ; conan profile update settings.os=Android android-clang-arm64-v8a ; conan profile update settings.arch=armv8 android-clang-arm64-v8a ; conan profile update settings.compiler=clang android-clang-arm64-v8a ; conan profile update settings.compiler.version=8 android-clang-arm64-v8a ; conan profile update settings.compiler.libcxx=libc++ android-clang-arm64-v8a ; conan profile update settings.os.api_level=21 android-clang-arm64-v8a ; conan profile update settings.compiler.cppstd=17 android-clang-arm64-v8a conan profile update settings.ceres-solver.build_type=Release
os_build should match your OS (Windows or Linux) |
If you show your profile by running:
conan profile show android-clang-arm64-v8a
You should obtain the following result:
Configuration for profile android-clang-arm64-v8a: [settings] os=Android os_build=Linux arch=armv8 arch_build=x86_64 compiler=clang compiler.version=8 compiler.libcxx=libc++ build_type=Release os.api_level=21 compiler.cppstd=17 [options] [conf] [build_requires] [env]
Now, you are ready to download your dependencies with Remaken.
ceres_solver package has problems with glog in debug mode, that is why Release build_type is forced for it in the conan profile. |
Remaken uses a file called packagedependencies.txt to describe which depedencies to install, in which version, where to install them, where to download them, with which package manager and with which configuration.
A global packagedepedencies.txt defining the common dependencies with specific packagedependencies-<os>.txt files defining dependencies which are specific for each os are available in the parent GIT repository SolAR, and can be downloaded on the following link:
Copy these files where you want on your computer, open a command prompt in the folder where you have copied the packagedependencies.txt and packagedependencies-<os>.txt files, and run remaken with the following command:
remaken install packagedependencies.txt
This command will install all SolAR dependencies in release mode.
To download the dependencies in debug mode, run the following command:
remaken install -c debug packagedependencies.txt
This is done, all your dependencies are downloaded and ready to use ! Some of the module will download and build third parties using Conan which requires CMake (minimum version 3.10).
SolAR is made up of a multitude of projects (SolAR Framework, SolAR pipeline manager, modules, samples, etc.). To help you, we have created a parent repository with sub-modules regrouping all source codes of SolAR projects. You can clone it from the following url: https://github.com/SolarFramework/SolAR.git
No space in the path of the folder where you are cloning SolAR ! |
git clone --recurse-submodules https://github.com/SolarFramework/SolAR.git
If you forgot to use --recurse-submodules
, you can initialize the submodules afterwards with:
cd SolAR git submodule update --init --recursive
If you want to move all submodules on HEAD of master
, launch the following commands
git submodule foreach --recursive git checkout master git submodule foreach --recursive git pull
If you do not want to download all the source codes of SolAR, you can have a look to the different repositories available on Github on the Community/Git page.
Build scripts are available in the scripts folder. Just run build_all.* to rebuild the SolAR framework, the modules and their tests, the pipelines and their tests, the samples, the services and their tests. If you want to rebuild them seprately, use the corresponding script. Check with build_all.* --help the different options such as the cross-build for Android, the number of processors to use, the version of Qt, the path to SolAR root folder, etc.
Linux is the prefered platform to perform an Android cross-build. |
Counting the framework, the pipeline manager, modules, module tests, samples, pipelines, pipeline tests, there are more than 60 QT projects on GitHub. In order to ease the building of all these projects, they are grouped in the following parent QT projects available into the root folder of SolAR:
SolARCore
SolARAllModules
SolARAllModulesTests
SolARAllSamples
SolARAllPipelines
SolARAllPipelineTests
SolARAllServices
SolARAllServicesTests
You can open one of them or all in QT Creator.
Check by clicking on the Projects
tab, and then on the Manage Kits…
button that your Qt x.x.x Android for arm64-v8a kit is well configured
The build
step will copy the built binaries into ${HOME}/.remaken/packages.
Disable step Make install and Build Android APK
|
Since QT Creator 4.14.0, we highly recommand to set the project option qmake system() behavior when parsing to Ignore to highly reduce the project loading time. But do not forget to run qmake on projects before building them.
|
If you open several projects, you will have to set their build order. You can do it in QT Creator by defining the dependencies of each project in the Projects
menu, select your project, click on Dependencies, and check the projects that depend directly on the selected project (checking `Synchronize configuration' will synchronize all projects in Debug or Release configuration).
Project | Project dependencies |
---|---|
SolARCore |
No dependency |
SolARAllModules |
SolARCore |
SolARAllModulesCuda |
SolARCore |
SolARAllModulesTests |
SolARAllModules |
SolARAllPipelines |
SolARAllModules |
SolARAllPipelineTests |
SolARAllPipelines |
SolARAllSamples |
SolARAllModules |
SolARAllServices |
SolARAllPipelines |
SolARAllServicesTests |
SolARAllServices |
If you have not yet run a qmake on each project, some error could appear concerning the fact that conanbuildinfo.pri files do not exist. This is normal, run qmake on each project will create these files, and the error message will no longer appear.
|
Then, in the Build
menu, click on Rebuild All Projects for All Configurations
, and go get a cup of coffee.
Now your shared libraries can be use as a SolAR module in Unity to build an Android application.
To build a SolAR Android application you need to have Android build support module installed.
Set your Unity Android environment. Then you need to set your current target platform of Unity Editor File > Build settings
to Android. In the player settings you must specify a package name (ex : com.company.appname) and set the configuration to support SolAR Framework.
SolAR modules provide support for AArch64 instruction sets through Application Binary Interface arm64-v8a. This is the most common architecture used by Android devices. |
Now you can import your SolAR modules and their dependencies in your Unity project in the dedicated directory ./Assets/Plugins/Android/
.
If you haven’t built or downloaded modules and dependencies for Android, execute ./plugin/unity/SolARUnityPlugin/Install.bat
.
Otherwise you could simply execute ./plugin/unity/SolARUnityPlugin/Bundle.bat
to bundle all of your Remaken packages and wrap SWIG.
You cannot directly test your pipeline in Unity Editor with modules built for Android. It is recommended to develop for your OS in a first time and then provide your module for Android. |
Congratulation, your configuration is ready to use and you can build your .apk with Unity to play it on your Android device. If necessary you can set Unity build settings options and use ADB to debug your app.
Moreover you can edit your pipeline configuration on your device. XML is stored in your public path of the application in your internal memory (ie : /storage/emulated/0/Android/data/com.company.appname/files/StreamingAssets/SolAR/Pipelines/*.xml
)
You can find more information for SolAR Android Unity pipeline in Unity Android Deployment