Installation
After installing the npm package, the Android native modules will be automatically linked via autolinking.ProGuard Configuration
If ProGuard is enabled in your Android project (for release builds), you must add a keep rule to prevent whisper.rn classes from being minified.Add ProGuard Rule
Add this rule toandroid/app/proguard-rules.pro:
Verify ProGuard is Enabled
Check yourandroid/app/build.gradle:
Microphone Permissions
To use realtime transcription features, you need to add microphone permissions and request them at runtime.Add Permission to Manifest
Add theRECORD_AUDIO permission to android/app/src/main/AndroidManifest.xml:
Request Permission at Runtime
Use React Native’sPermissionsAndroid API to request the permission:
Check Permission Status
You can also check if the permission is already granted:NDK Version
For Apple Silicon Macs, it’s recommended to use NDK version 24.0.8215888 or above to avoid build errors.Set NDK Version
Inandroid/build.gradle, specify the NDK version:
If you encounter build errors on Apple Silicon Macs with messages like “unknown host CPU architecture: arm64”, update your NDK version.
Architecture Support
whisper.rn supports all common Android architectures:armeabi-v7a(32-bit ARM)arm64-v8a(64-bit ARM)x86(32-bit Intel)x86_64(64-bit Intel)
armv8.2-a+fp16 on supported devices.
16KB Page Size Support
whisper.rn supports Android 15+ devices with 16KB page sizes. No additional configuration is required.GPU Acceleration
Unlike iOS which uses Metal, Android doesn’t currently have GPU acceleration for whisper.cpp. All processing runs on CPU.GPU acceleration on Android may be added in future versions. For now, optimize performance by choosing appropriate model sizes and thread counts.
Build Configuration
New Architecture Support
whisper.rn supports both the Old and New React Native architectures. The library will automatically detect which architecture you’re using. To enable the New Architecture, follow the React Native docs.CMake Build
The native C++ code is built using CMake. The configuration is handled automatically, but if you need to customize it, seeandroid/CMakeLists.txt in the whisper.rn package.
Minimum SDK Version
whisper.rn supports:- Minimum SDK: 23 (Android 6.0)
- Target SDK: 34+ recommended
Release Build Optimization
Enable ProGuard
For smaller APK size and better performance in release builds:Split APKs by Architecture
Reduce APK size by building separate APKs for each architecture:Performance Tips
- Test in Release mode - Debug builds are significantly slower
- Use quantized models - q8, q5 models are smaller and faster
- Adjust thread count - Default is optimized, but you can customize:
- Choose appropriate model size - tiny/base models work well on most Android devices
Common Build Issues
Unknown host CPU architecture on Apple Silicon
Error:unknown host CPU architecture: arm64
Solution: Update NDK version to 24.0.8215888 or higher
ProGuard crashes in release
Error:ClassNotFoundException or crashes when calling whisper.rn functions
Solution: Add the ProGuard keep rule:
JNI errors
Error:UnsatisfiedLinkError or JNI-related crashes
Solution: Clean and rebuild:
Out of memory
Error: App crashes with large models Solution: Use quantized models or smaller model sizes. For very large models, consider:Testing
Debug Build
Release Build
Test performance in release mode:React Native Versions
whisper.rn is compatible with:- React Native 0.70+
- Both Old and New Architecture
- Expo (with prebuild)
Next Steps
- Basic Usage - Learn how to transcribe audio
- Realtime Transcription - Set up live transcription
- Voice Activity Detection - Detect speech segments