ZXingLite: A Slimmer ZXing Wrapper for Android Barcode Scanning
🔥 ZXing的精简极速版,优化扫码和生成二维码/条形码,内置闪光灯等功能。扫描风格支持:微信的线条样式,支付宝的网格样式。几句代码轻松拥有扫码功能 ,ZXingLite让集成扫码更简单。
At a glance
- What is it?
- ZXingLite is an Apache-2.0 Kotlin library that wraps ZXing for Android, adding camera scanning, a configurable decode pipeline and QR/barcode generation. It fits apps that want WeChat-style or Alipay-style scanning screens without building the camera layer themselves.
- Who is it for?
- Adopt ZXingLite if you are building an Android app that needs an in-app scanner and you are willing to inherit the CameraScan and ViewfinderView dependencies and their package names. Do not adopt it if you need iOS, a desktop tool, or a scanning pipeline you can tune beyond the DecodeConfig options, and do not adopt it on a module pinned below compileSdk 35 if you want the current 3.5.0 release.
- Can I use it commercially?
- Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 107 days ago.
- What is it written in?
- Mainly Kotlin, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on September 30, 2026, and from our analysis. They are not legal advice.
Editorial analysis
What ZXingLite Actually Replaces
ZXing is a Java barcode library. It decodes image data and encodes QR codes and barcodes, and it has no opinion about Android cameras, preview surfaces, or scan animations. An Android app that wants a scanner therefore has to wire a camera preview to a frame analyzer, crop the preview to a scan region, run ZXing on the cropped frames, and draw a viewfinder overlay. ZXingLite exists to remove that wiring. The README describes it as a trimmed, faster edition of ZXing for Android that optimizes scanning and QR/barcode generation, with a fully customizable scan screen. The target reader is an Android developer who wants a working scanner screen in a few lines of code, not a camera pipeline. It is Kotlin, licensed Apache-2.0, and published to Maven Central under com.github.jenly1314:zxing-lite. The repository also ships a demo APK link, so you can look at the result before committing to the dependency. The project does not attempt to be a cross-platform scanner or a server-side decoder. Everything in it is Android-specific.
The CameraScan Split and What It Costs You
The most important structural fact about the 3.x line is that the core camera classes no longer live in ZXingLite. From 3.0.0 onward, ZXingLite depends on CameraScan, a separate library that owns the generic scan flow, and on ViewfinderView, a separate library that renders the scanning animation. The old 2.x classes CaptureActivity, CaptureFragment and ViewfinderView were removed, and CaptureActivity and CaptureFragment were replaced by BarcodeCameraActivity and BarcodeCameraFragment. The README is explicit that the package names of the extracted libraries changed, and it tells 2.x users to upgrade cautiously. That is a real migration cost, not a documentation footnote. If you are on 2.x, moving to 3.x means touching imports, base classes and any custom viewfinder code. The payoff is that the camera plumbing is maintained once and shared across the author's scanning libraries rather than duplicated inside ZXingLite. The cost is that your dependency graph now has three moving parts, and a behavior change in CameraScan can surface as a change in your scanner.
DecodeConfig, Analyzers and the Scan Rectangle
Inside ZXingLite, the decode behavior is controlled by DecodeConfig and executed by an Analyzer implementation. The library ships several analyzers, but the README points at two as the ones you normally need: MultiFormatAnalyzer, which handles multiple barcode formats, and QRCodeAnalyzer, which handles QR codes only. The README's own reasoning is that a QR-only analyzer exists because many apps only ever scan QR codes, and it recommends MultiFormatAnalyzer when you need continuous scanning or are unsure which to pick. What each analyzer can actually decode is not hardcoded; it follows the hints you set through DecodeConfig. DecodeFormatManager groups barcode formats into ready-made hint sets, and the README example uses DecodeFormatManager.QR_CODE_HINTS when only QR codes matter, noting that this is more efficient than the default DecodeFormatManager.DEFAULT_HINTS. The same config object controls the scan region: setFullAreaScan(false) keeps scanning to a sub-rectangle of the preview, setAreaRectRatio(0.8f) sets that rectangle's size, and setAreaRectVerticalOffset and setAreaRectHorizontalOffset shift it, with 0 meaning centered and negative values allowed. This is the part worth reading twice. The rectangle you configure is a crop of the preview frame, so a viewfinder drawn in a different place than the configured rectangle will mislead users about where to aim.
Installing ZXingLite and Scanning Your First Code
The README gives a two-step Gradle setup. Add mavenCentral() to the repositories block in the project-level build.gradle or settings.gradle, then add the dependency in the module build.gradle. The published coordinates for the current release are shown here exactly as the README lists them.
repositories {
//...
mavenCentral()
}implementation 'com.github.jenly1314:zxing-lite:3.5.0'Version selection is not free. The README states that 3.4.0 and above require compileSdk 35 or higher, 3.1.0 and above require compileSdk 34 or higher, and 3.0.0 and above require compileSdk 33 or higher. If your compileSdk is below 33, the README directs you to the 2.x branch. Once the dependency resolves, the shortest path to a scanner is to subclass BarcodeCameraScanActivity, return a layout from getLayoutId, build a DecodeConfig in createAnalyzer and return an analyzer, then handle the result in onScanResultCallback. The README's full example follows that shape, including cameraScan.setPlayBeep(true) in initCameraScan and cameraScan.setAnalyzeImage(false) in the callback to stop analysis before finishing. The callback reads the decoded text from result.result.text and passes it back through an Intent using the CameraScan.SCAN_RESULT key. BarcodeCameraScanFragment works the same way when the scanner belongs inside a fragment rather than its own activity.
Generating Codes Without a Camera
Scanning is only half of what the library does. CodeUtils is the utility class for parsing and generating codes, and it does not require a camera, an activity, or the scanning pipeline at all. The README lists four calls: createQRCode for QR generation, createBarCode for barcode generation with a format such as BarcodeFormat.CODE_128, parseCode for decoding either kind from a bitmap, and parseQRCode for QR-only decoding. The generation calls take explicit dimensions, so the output size is your decision rather than a library default. This makes ZXingLite usable in apps that never open a camera, for example an app that renders a QR code for a payment link or a device pairing token. It also means the parsing side can be tested against static bitmaps, which is a simpler integration path than a live camera preview when you are first evaluating whether the decode hints you chose actually match the codes your users will present. The README does not describe error handling for malformed input to these calls, so treat failure behavior as something to check in your own code.
Where ZXingLite Is the Wrong Choice
The library is Android-only and its API surface is built around Android activities, fragments and camera previews. If you are shipping an iOS app, a Flutter app, or a backend service that decodes uploaded images, none of the scanning code applies, and you would be better served by ZXing directly or by a cross-platform wrapper. The version constraints are another boundary. The README ties each release line to a minimum compileSdk, so a project pinned to an older SDK cannot take the current release without moving its build configuration. There is also a JDK detail in the history: the README notes that versions from 2.3.0 to 3.0.1, which used ZXing 3.5.1, needed core library desugaring to support minSdk below 24, while 3.1.0 and later do not, because ZXing 3.5.2 restored compatibility with older JDKs. If you are on an older ZXingLite release and targeting Android 7.0 or below, that desugaring block is part of your build, not an optional extra. Finally, the library is a wrapper, not a replacement for the decoder. If ZXing cannot read a damaged or low-contrast code, ZXingLite will not read it either, and no amount of scan-region tuning changes that.
Alternatives and the Difference in Approach
The README's own related-projects list is the fairest place to compare, because it names libraries maintained by the same author. CameraScan is the generic base library that ZXingLite builds on; it handles the scan flow and camera interaction but has no decoder of its own, so choosing it means supplying your own analysis logic. WeChatQRCode takes a different route entirely: it ports the WeChat QR engine built on OpenCV, so recognition runs through that engine rather than through ZXing. MLKit is the widest of the three, covering text recognition, barcode recognition, image labeling, face detection and object detection, which means it is a general vision toolkit rather than a scanner. The practical difference is dependency weight and control. ZXingLite keeps you on ZXing's decoding behavior with Android-specific conveniences layered on top; WeChatQRCode changes the recognition engine; MLKit brings a broader SDK in exchange for capabilities ZXingLite does not attempt. If your requirement is a QR-only scanner with a small dependency footprint, ZXingLite plus QRCodeAnalyzer is the narrow option. If you need multiple vision features in one SDK, that is a different decision.
Maintenance, Licensing and Upgrade Cost
The repository is not archived, and the last push was on 2026-06-16. Release 3.5.0 carries the same date, with 3.4.1 in March 2026 and 3.4.0 in February 2026, so the release cadence across 2026 has been roughly one minor or patch release every few weeks to a few months. The licence is Apache-2.0, which permits commercial use and modification; the repository includes a LICENSE file, and if you redistribute the library or a modified version you should read that file and the NOTICE requirements it implies rather than relying on a summary. The upgrade cost is dominated by the 3.x restructuring. Because CameraScan and ViewfinderView are separate libraries with their own package names, a 2.x to 3.x upgrade is not a version bump; it is an import and base-class migration. Within 3.x, the README's compileSdk table is the thing to check before bumping, since each release line raises the floor. The README does not document a rollback procedure, so pinning versions and reading CHANGELOG.md before upgrading is the practical safeguard.
Editorial conclusion
Adopt ZXingLite if you are building an Android app that needs an in-app scanner and you are willing to inherit the CameraScan and ViewfinderView dependencies and their package names. Do not adopt it if you need iOS, a desktop tool, or a scanning pipeline you can tune beyond the DecodeConfig options, and do not adopt it on a module pinned below compileSdk 35 if you want the current 3.5.0 release. Before writing code, verify three things in your own project: that your compileSdk matches the version you pick, that the ViewfinderView layout you design covers the scanning area you configure in DecodeConfig, and that your minSdk still works with the ZXing version the release pulls in.
Frequently asked questions
What is ZXingLite and what is it for?
ZXingLite is an Android library that wraps ZXing to optimize barcode scanning and QR/barcode generation, with a fully customizable scan screen. It is aimed at Android developers who want to add scan recognition to an app quickly.
How do I install ZXingLite in a Gradle project?
Add mavenCentral() to the repositories block in the project-level build.gradle or settings.gradle, then add the dependency com.github.jenly1314:zxing-lite:3.5.0 to the module build.gradle. Note that 3.4.0 and above require compileSdk 35 or higher.
Can ZXingLite create QR codes as well as scan them?
Yes. CodeUtils provides createQRCode for QR codes, createBarCode for barcodes with a format such as BarcodeFormat.CODE_128, and parseCode and parseQRCode for decoding from a bitmap.
What changed between ZXingLite 2.x and 3.x?
The CameraScan core classes, ViewfinderView, and the CaptureActivity and CaptureFragment base classes were removed from ZXingLite; from 3.0.0 the project depends on the separate CameraScan and ViewfinderView libraries, and the base classes became BarcodeCameraActivity and BarcodeCameraFragment. The README warns that the extracted libraries have changed package names and advises upgrading cautiously.
Does ZXingLite require Java 8 desugaring?
Only for versions 2.3.0 through 3.0.1, which used ZXing 3.5.1, and only when supporting minSdk below 24. From 3.1.0 onward the README states desugaring is not needed because ZXing 3.5.2 restored compatibility with older JDKs.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/jenly1314-zxinglite)