Last Updated on December 21, 2019
Please read the general build guide for information on building other platforms. Only Android specific instructions are found in this file. Note that these instructions apply to building for Oculus Quest.
Building is currently supported on Windows, OSX and Linux, but developers intending to do work on the library dependencies are strongly urged to use 64 bit Linux as a build platform.
Please install the dependencies for your OS using the Windows, OSX or Linux build instructions before attempting to build for Android.
Download the Android Studio installer and run it. Once installed, at the welcome screen, click Configure in the lower right corner and select SDK Manager.
From the SDK Platforms tab, select API levels 26 and 28.
From the SDK Tools tab, select the following
- Android SDK Build-Tools
- GPU Debugging Tools
- LLDB
- Android SDK Platform-Tools
- Android SDK Tools
- NDK (even if you have the NDK installed separately)
Still in the SDK Tools tab, click Show Package Details. Select CMake 3.6.4. Do this even if you have a separate CMake installation.
Also, make sure the NDK installed version is 18 (or higher).
Follow the directions here to create a keystore file. You can save it anywhere (preferably not in the hifi
folder).
Create a gradle.properties
file in the .gradle
folder ($HOME/.gradle
on Unix, Users/<yourname>/.gradle
on Windows). Edit the file to contain the following
HIFI_ANDROID_PRECOMPILED=<your_home_directory>/Android/hifi_externals
HIFI_ANDROID_KEYSTORE=<key_store_directory>/<keystore_name>.jks
HIFI_ANDROID_KEYSTORE_PASSWORD=<password>
HIFI_ANDROID_KEY_ALIAS=<key_alias>
HIFI_ANDROID_KEY_PASSWORD=<key_passwords>
Note, do not use $HOME for the path. It must be a fully qualified path name. Also, be sure to use forward slashes in your path.
Add these lines to gradle.properties
SUPPRESS_QUEST_INTERFACE
SUPPRESS_QUEST_FRAME_PLAYER
Add these lines to gradle.properties
SUPPRESS_INTERFACE
SUPPRESS_FRAME_PLAYER
The above code to suppress modules is not necessary, but will speed up the build process.
git clone https://github.com/kasenvr/project-athena.git
- Open Android Studio
- Choose Open an existing Android Studio project
- Navigate to the
hifi
repository and choose theandroid
folder and select OK - Wait for Gradle to sync (this should take around 20 minutes the first time)
- From the Build menu select Make Project
- In the toolbar at the top of Android Studio, next to the green hammer icon, you should see a dropdown menu.
- You may already see a configuration for the module you are trying to build. If so, select it.
- Otherwise, select Edit Configurations.
Your configuration should be as follows
- Type: Android App
- Module: (you probably want
interface
orquestInterface
)
For the interface modules, you also need to select the activity to launch.
- From the Launch drop down menu, select Specified Activity
- In the Activity field directly below, put
io.highfidelity.hifiinterface.PermissionChecker
- From the Launch drop down menu, select Specified Activity
- In the Activity field directly below, put
io.highfidelity.questInterface.PermissionsChecker
Note the 's' in PermissionsChecker for the Quest.
Now you are able to run your module! Click the green play button in the top toolbar of Android Studio.
To view a more complete debug log,
- Click the icon with the two overlapping squares in the upper left corner of the tab where the sync is running (hover text says Toggle view)
- To change verbosity, click File > Settings. Under Build, Execution, Deployment > Compiler you can add command-line flags, as per Gradle documentation
Some things you can try if you want to do a clean build
- Delete the
build
and.externalNativeBuild
folders from the folder for each module you're building (for example,hifi/android/apps/interface
) - If you have set your
HIFI_VCPKG_ROOT
environment variable, delete the contents of that directory; otherwise, deleteAppData/Local/Temp/hifi
- In Android Studio, click File > Invalidate Caches / Restart and select Invalidate and Restart
If you see lots of "couldn't acquire lock" errors,
- Open Task Manager and close any running Clang / Gradle processes