Installation
Install the React Native Sherpa-ONNX SDK and configure it for your platform.Install Package
Peer Dependencies
The SDK requires@dr.pogodin/react-native-fs for file system operations:
Platform Setup
- Android
- iOS
Android Configuration
No additional setup required! The library automatically handles native dependencies via Gradle.The SDK includes:- sherpa-onnx native libraries - Automatically downloaded during build
- ONNX Runtime - Bundled with execution provider support
- Hardware acceleration - CPU, NNAPI, XNNPACK, and QNN support
Optional: QNN (Qualcomm Neural Network) Setup
For Qualcomm Snapdragon devices with AI accelerator support:Check device support
QNN provides hardware acceleration on Qualcomm Snapdragon chipsets with AI Engine (Hexagon DSP).
See Execution Provider Support for details on NNAPI, XNNPACK, and QNN configuration.
Build from Source (Advanced)
To build Android native libraries yourself:third_party/sherpa-onnx-prebuilt/ANDROID_RELEASE_TAG.Verify Installation
Test that the native library loads correctly:App.tsx
Check Execution Providers
Verify available hardware acceleration:Next Step: Follow the Quick Start Guide to transcribe your first audio file or generate speech.
Troubleshooting
iOS: XCFramework download fails
iOS: XCFramework download fails
If
pod install fails to download the XCFramework:- Check internet connection: The framework is ~80MB and requires a stable connection.
- Manual download: Download from GitHub Releases and place in
node_modules/react-native-sherpa-onnx/ios/Frameworks/. - Check version: Ensure the release tag matches
third_party/sherpa-onnx-prebuilt/IOS_RELEASE_TAG.
Android: Build fails with native library errors
Android: Build fails with native library errors
Common issues:
- Gradle sync: Run
cd android && ./gradlew cleanthen rebuild. - NDK version: Ensure you have NDK 21 or later installed.
- Memory: Gradle may need more memory. Add to
android/gradle.properties:
Yarn PnP issues
Yarn PnP issues
If using Yarn v3+ with Plug’n’Play:Or use the environment variable:
.yarnrc.yml
Missing peer dependency error
Missing peer dependency error
Install the required peer dependency:Then rebuild:
Next Steps
Quick Start
Build your first speech recognition app
Download Models
Learn how to download and bundle models
STT API Reference
Explore speech-to-text features
TTS API Reference
Explore text-to-speech features