ZXing-C++ Android Library
June 19, 2026 ยท View on GitHub
Install
The easiest way to use the library is to fetch if from mavenCentral. Simply add one of the following two lines
implementation("io.github.zxing-cpp:android:3.1.0")
implementation("io.github.zxing-cpp:android:3.2.0-SNAPSHOT")
to your build.gradle.kts file in the dependencies section. To access the SNAPSHOT version, you also need to add a separate repositories entry in your build.cradle.kts file:
maven { url = uri("https://central.sonatype.com/repository/maven-snapshots/") }
Use
A trivial use case looks like this (in Kotlin):
import zxingcpp.BarcodeReader
var barcodeReader = BarcodeReader()
fun process(image: ImageProxy) {
image.use {
barcodeReader.read(it)
}.joinToString("\n") { result ->
"${result.format} (${result.contentType}): ${result.text}"
}
}
Build locally
- Install AndroidStudio including NDK and CMake (see 'SDK Tools').
- Open the project in folder containing this README.
- The project contains 2 modules:
zxingcppis the wrapper library,appis the demo app usingzxingcpp.
To build the AAR (Android Archive) from the command line:
$ ./gradlew :zxingcpp:assembleRelease
Then copy zxingcpp/build/outputs/aar/zxingcpp-release.aar into app/libs of your app.