Depending on which NDK, SDK, and API versions you are using, you may need to change the version of Java you have. Java-21 is not supported for may of the common combinations of these versions, but Java-17 is widely supported.
Note
ILLIXR for Android is known to work with Android SDK 33.0, NDK 27.2.12479018, and Gradle 8.10. Any other configuration may require changes to the code.
This is for signing the App
$JAVA_HOME/bin/keytool -genkeypair -v -keystore /home/friedel/illixr.keystore -alias illixr -keyalg RSA -keysize 2048 -validity 10000For any passwords, use illixr, most other questions are optional. If you want a different password, you will need to change a few lines
in app/build.gradle.
-
Download Android Studio from here.
-
Extract the archive
tar xf <FILE_NAME>
-
Launch Android Studio with the following and accept licences.
android-studio/bin/studio.sh
-
Configure the build system
- Open the
SDK ManagerTools -> SDK Manager - Select the platform version to use (in the
SDK Platformstab)- this should be the Android version of your device, at minimum
- our testbed is running Android 13.0, so we will use API level 33 in this example
- Switch to the
SDK Toolstab - Under
Android SDK Build-Toolscheck 33.0.0 if it is not already - Scroll down to the
NDKsection and check27.2.12479018and21.4.7075529if they are not already checked - Scroll down to the
Android SDK Command-line Toolssection and check the entry for 13.0, if it is not already checked - Scroll down to the
CMakesection and check the entry for3.22.1if it is not already checked - Click
OK - Android Studio will download and install the requested components, this may take a while
- The installed components should be in
${HOME}/Android/Sdk
- Open the
For this project, we only built for the arm64-v8a architecture, as it is the architecture of our test device.
If your has a different architecture, you will need to make changes to some of the commands below, as well as
some lines in a build.gradle file.
We leave it up to the user to connect their Android device to Android Studio. Instructions on this and how to build a run an App can be found on the Android documentation pages.
While ILLIXR for Android depends on several common packages, the versions installed by OS packages managers are not compatible with the Android architecture and need to be built from source. The ILLIXR build system will compile these libraries for you, and store them in the third_party folder. Only delete the contents of this folder if you wish to rebuild these external libraries.
-
Clone the repository
cd ${ROOT_DIR} git clone https://github.com/ILLIXR/illixr_android.git
-
Re-open Android Studio so it can pick up any new environment variables.
-
Open it in Android Studio
File -> Open- Navigate the repo you just cloned
- Click
Open
-
Wait for the Gradle Sync to finish.
-
If you need to build for a different architecture or for different SDK versions, edit the necessary lines in
${ROOT_DIR}/illixr_android/app/build.gradle
-
Now we have all the dependencies ready to build the project. Hit the build button in Android Studio to build the project. If there are errors make sure all the paths set in the previous steps are correct.
-
We need to manually install data required for GlDemo and Pose_lookup. However we can ony do it when the application is installed on the phone. So, hit the run button and install the application on the phone. The app won't run because we haven't added the data yet.
-
Now while the phone is connected open Device File Explorer located on the right hand side menu of Android Studio. Select the device name. Navigate to
/sdcard/Android/data/com.example.native_activity. Right click and select Upload, now navigate to the folderillixr_android/app/src/main/cpp/and select mav0. Do the same for demo_data. mav0 contains the ground truth pose form EuRoC dataset required for Pose_lookup and demo_data is used by gldemo. -
It is possible that the app is not installed in sdcard but only present in the internal memory which is
/data/data/com.example.native_activity. In this case install the mav0 and demo_data inside/data/data/com.example.native_activity. -
Based on where the data is installed, change the application path in
illixr_android/app/src/main/cpp/main.cppline 23.
- The application needs permissions to read and write files. Go to setting in the Android phone, search for native-activity. In the application details go to the permissions section. It will show all the permission that are denied to the application. Click on them to allow the app these permissions. This step may look different based on the specific phone model.
Now we have everything we need to run GlDemo on an Android Phone. Hit the run button, it should open the application and you can see the GlDemo scene.
We use a version of Monado to act as an OpenXR interface.
-
Clone the repo
git clone https://github.com/ILLIXR/Illixr_Monado_Android.git
-
Open Android Studio
-
Update the tools (these choices are much less flexible than for ILLIXR)
- Open the
SDK ManagerTools -> SDK Manager - Under
Android SDK Build-Toolscheck 31.0.0 if it is not already - Scroll down to the
NDKsection and check21.4.7075529if it is not already checked - Scroll down to the
CMakesection and check the entry for3.10.2if it is not already checked
- Open the
-
Open the ILLIXR for Android project
-
Edit
app/src/main/cpp/CMakeLists.txt, by uncommenting theadd_definitions(-DENABLE_MONADO=1)line -
Rebuild ILLIXR for Android
-
Copy the libraries into the Monado build
mkdir -p ${ROOT_DIR}/Illixr_Monado_Android/src/xrt/targets/openxr_android/src/main/jniLibs/arm64-v8a cp ${ROOT_DIR}/illixr_android/app/build/intermediates/merged_native_libs/debug/out/lib/arm64-v8a/*.so ${ROOT_DIR}/Illixr_Monado_Android/src/xrt/targets/openxr_android/src/main/jniLibs/arm64-v8a/.
-
Open the ILLIXR_Monado_Android project in Android Studio
-
Configure and build
-
You can now run Monado on your phone in the background and connect to it via OpenXR enabled Apps.
//: (- references -)
We use a version of Monado to act as an OpenXR interface.
-
Clone the repo
git clone https://github.com/ILLIXR/Illixr_Monado_Android.git
-
Open Android Studio
-
Update the tools (these choices are much less flexible than for ILLIXR)
- Open the
SDK ManagerTools -> SDK Manager - Under
Android SDK Build-Toolscheck 31.0.0 if it is not already - Scroll down to the
NDKsection and check21.4.7075529if it is not already checked - Scroll down to the
CMakesection and check the entry for3.10.2if it is not already checked
- Open the
-
Open the ILLIXR for Android project
-
Edit
app/src/main/cpp/CMakeLists.txt, by uncommenting theadd_definitions(-DENABLE_MONADO=1)line -
Rebuild ILLIXR for Android
-
Copy the libraries into the Monado build
mkdir -p ${ROOT_DIR}/Illixr_Monado_Android/src/xrt/targets/openxr_android/src/main/jniLibs/arm64-v8a cp ${ROOT_DIR}/illixr_android/app/build/intermediates/merged_native_libs/debug/mergeDebugNativeLibs/out/lib/arm64-v8a/*.so ${ROOT_DIR}/Illixr_Monado_Android/src/xrt/targets/openxr_android/src/main/jniLibs/arm64-v8a/.
-
Open the ILLIXR_Monado_Android project in Android Studio
-
Configure/Sync and build
-
You can now run Monado on your phone in the background and connect to it via OpenXR enabled Apps.