IronOxide-Android
February 6, 2026 ยท View on GitHub
Using IronOxide-Android
In order to make calls to the IronCore service, you must add a dependency for ironoxide-android, load the library, and provide authentication.
Adding a dependency
Add the following to your module's "build.gradle":
dependencies {
implementation 'com.ironcorelabs:ironoxide-android:<VERSION>@aar'
}
Loading the library
To load the ironoxide-android library in Java, use the following:
java.lang.System.loadLibrary("ironoxide_android");
Authenticating
To make calls, you must create a project and segment in the IronCore Admin Console. These are necessary to create an IronCore JWT that can be used to create users and generate devices. The JWT must use either the ES256 or RS256 algorithm and have a payload similar to IronOxide's JwtClaims.
Alternatively, once you have created a project and a segment, you can use a tool such as ironoxide-cli to create users and devices directly.
You can then read in a device with the DeviceContext.fromJsonString() function and use it to initialize an IronOxide instance. An example of this is available in the
Example Application in "MainActivity.java".
Build from Source
Prerequisites
There's a
shell.nixthat can be used vianix-shellthat'll bootstrap an environment where you can test with a plugged in local Android device.
-
Install Rust toolchain.
-
Install Android SDK 36. You can get the command line SDK here (scroll down to "Command line tools only").
- Note: The extracted
toolsfolder must follow a specific folder hierarchy. We recommendAndroidCLI/cmdline-tools/tools.
- Note: The extracted
-
Install Android 36 build and platform tools. This can be done with
sdkmanager(found intools/bin):./sdkmanager "build-tools;36.0.0" "platform-tools" "platforms;android-36" -
Create the file
$HOME/.gradle/gradle.propertiesand add the linesdk.dir=PATH_TO_ANDROID_CLI_FOLDER.
Building
From the repository root, run android/build.sh.
This will compile IronOxide-Android for x86_64, arm64-v8a, and armeabi-v7a, covering both emulators and physical devices. The compiled library and generated Java files will be put into android/ironoxide-android/src/main.
Testing
Prerequisites
- Successfully run
build.shby following the steps in Build from Source. - An Android emulator running, or a compatible Android phone connected.
Emulator Testing
To start an emulator using the command line tools, follow these steps from the folder AndroidCLI/cmdline-tools/tools/bin:
./sdkmanager "emulator" "system-images;android-36;google_apis;x86_64"./avdmanager create avd -n pixel -k "system-images;android-36;google_apis;x86_64" -d pixel../../../emulator/emulator -avd pixel -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim
The emulator may take some time to boot, but the output will include emulator: INFO: boot completed when it has completed. You will need to use a different terminal to run the tests.
Physical Device Testing
You can also run tests on a physical Android device connected via USB or Wi-Fi debugging. The nix-shell environment is set up to support connected device testing. Ensure USB debugging is enabled on the device and it appears in adb devices.
Running the Connected Android Tests
Run the tests from the android folder with:
./gradlew connectedAndroidTest