Skip to main content

InferX Android SDK

The InferX Android SDK allows you to run state-of-the-art AI models directly on your Android device, without requiring an internet connection for inference. Same API, optimized for mobile.

Features

  • Offline Inference: Run models locally without internet connection
  • Cross-Device Compatibility: Same API across mobile and server deployments
  • Optimized Performance: Hardware-accelerated inference on mobile devices
  • Easy Integration: Simple SDK integration into existing Android apps
We provide a complete Android application that demonstrates the usage of the InferX Android SDK: Example Repository: github.com/exla-ai/InferX-android-example

Quick Start

Prerequisites

  1. Android Studio installed
  2. Android device or emulator (API level 21+)
  3. JitPack repository access
To view a demo of using the SDK, check out the example: github.com/exla-ai/InferX-android-example

Setting Up the SDK

1. Configure JitPack Repository

Add JitPack to your project-level build.gradle or build.gradle.kts:

2. Add SDK Dependency

Add the InferX Android SDK dependency to your app’s build.gradle.kts:

3. Add Permissions

Add required permissions to your AndroidManifest.xml:

Basic Usage

Initialize the SDK

Run Inference

Advanced Usage

Custom Model Configuration

Real-time Camera Processing

Batch Processing

Complete Example

Here’s a basic example of how to use the InferX Android SDK:

Performance Tips

  • Model Caching: Models are automatically cached after first download
  • Batch Processing: Use batch inference for multiple images to improve efficiency
  • Memory Management: Release models when not needed to free memory
  • Thread Management: SDK handles threading automatically, but avoid blocking the main thread

Supported Models

The Android SDK currently supports:
  • CLIP: Image-text matching and understanding
  • MobileNet: Efficient image classification
  • ResNet: High-accuracy image classification
More models coming soon!

Troubleshooting

Common Issues

  1. Model Download Fails: Check internet connection and storage space
  2. Inference Slow: Ensure device has sufficient RAM and consider reducing input size
  3. Crashes on Older Devices: Check minimum API level requirements

Debug Mode

Enable debug logging to get more detailed information:

Next Steps