|
|
10 mesi fa | |
|---|---|---|
| .. | ||
| app | 10 mesi fa | |
| gradle | 10 mesi fa | |
| zxingcpp | 10 mesi fa | |
| README.md | 10 mesi fa | |
| build.gradle.kts | 10 mesi fa | |
| gradle.properties | 10 mesi fa | |
| gradlew | 10 mesi fa | |
| gradlew.bat | 10 mesi fa | |
| settings.gradle.kts | 10 mesi fa | |
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:2.2.0")
implementation("io.github.zxing-cpp:android:2.3.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://s01.oss.sonatype.org/content/repositories/snapshots") }
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}"
}
}
zxingcpp is the wrapper library, app is the demo app using zxingcpp.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.