-
Notifications
You must be signed in to change notification settings - Fork 0
Building From Source
Luc Côté edited this page Jul 6, 2026
·
1 revision
You don't need to build the AAR to use it (implementation("dev.ffmpegkit-maintained:tesseract-android:5.5.0")).
These notes are for contributors and for reproducing the artifact.
- JDK 17
- Android SDK, NDK r27c (
27.2.12479018), CMake 3.22.1 - Ninja (
apt-get install ninja-build)
sdkmanager "ndk;27.2.12479018" "cmake;3.22.1"Leptonica and Tesseract are pinned git submodules:
git clone --recursive https://github.com/ffmpegkit-maintained/TesseractOCR.git
cd TesseractOCR
# or, if already cloned:
git submodule update --init --recursive| Submodule | Upstream | Pinned tag |
|---|---|---|
leptonica |
github.com/DanBloomberg/leptonica | 1.84.1 |
tesseract |
github.com/tesseract-ocr/tesseract | 5.5.0 |
./gradlew :library:assembleRelease
# → library/build/outputs/aar/library-release.aarThe native build (library/src/main/jni/CMakeLists.txt) does, in order:
- Build Leptonica as
libleptonica.so(BUILD_PROG=OFF,SW_BUILD=OFF). - Build Tesseract as
libtesseract.so(training tools, curl, archive, graphics all disabled;OPENMP_BUILD=OFFfor Free). - Build the JNI bridge
libtesseract_jni.so, linking both.
All .so are linked with 16 KB max-page-size for Android 15 compatibility.
Free builds arm64-v8a only (abiFilters in library/build.gradle.kts). The Pro
variant adds x86_64.
./gradlew :sample:installDebugPick an image; it OCRs with the bundled English model and shows text + confidence.
Handled by GitHub Actions:
-
build-debug.yml— CI build on push/PR. -
build-release.yml— release AAR + GitHub Release onv*tags. -
publish-maven.yml— manual, verifies the native lib then publishes to Maven Central (irreversible; run only after validation).