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
Quick Start
Prerequisites
- Android Studio installed
- Android device or emulator (API level 21+)
- JitPack repository access
Setting Up the SDK
1. Configure JitPack Repository
Add JitPack to your project-levelbuild.gradle
or build.gradle.kts
:
2. Add SDK Dependency
Add the InferX Android SDK dependency to your app’sbuild.gradle.kts
:
3. Add Permissions
Add required permissions to yourAndroidManifest.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
Troubleshooting
Common Issues
- Model Download Fails: Check internet connection and storage space
- Inference Slow: Ensure device has sufficient RAM and consider reducing input size
- Crashes on Older Devices: Check minimum API level requirements
Debug Mode
Enable debug logging to get more detailed information:Next Steps
- Explore the full example app
- Try different InferX models in your app
- Learn about optimizing mobile performance