journeyapps /zxing-android-embedded
Barcode scanner library for Android, based on the ZXing decoder
★ 5,932⑂ 1,283👁 169⑃ 113● 612▤ 9
-1
日增长
5,932
stars
1,283
forks
169
watchers
113
prs
612
issues
9
releases
README
ZXing Android Embedded
Barcode scanning library for Android, using [ZXing][2] for decoding.
The project is loosely based on the [ZXing Android Barcode Scanner application][2], but is not affiliated with the official ZXing project.
Features:
1. Can be used via Intents (little code required).
2. Can be embedded in an Activity, for advanced customization of UI and logic.
3. Scanning can be performed in landscape or portrait mode.
4. Camera is managed in a background thread, for fast startup time.
A sample application is available in Releases.
By default, Android SDK 24+ is required because of zxing:core 3.4.x.
SDK 19+ is supported with additional configuration, see Older SDK versions.
Adding aar dependency with Gradle
Add the following to your build.gradle file:
groovy
// Config for SDK 24+
repositories {
mavenCentral()
}
dependencies {
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
}
Older SDK versions
By default, only SDK 24+ will work, even though the library specifies 19 as the minimum version.
For SDK versions 19+, one of the changes below are required.
Some older SDK versions below 19 may work, but this is not tested or supported.
Option 1. Downgrade zxing:core to 3.3.0
groovy
repositories {
mavenCentral()
}
dependencies {
implementation('com.journeyapps:zxing-android-embedded:4.3.0') { transitive = false }
implementation 'com.google.zxing:core:3.3.0'
}
Option 2: Desugaring (Advanced)
This option does not require changing library versions, but may complicate the build process.
This requires Android Gradle Plugin version 4.0.0 or later.
See Java 8+ API desugaring support.
Example for SDK 21+:
groovy
android {
defaultConfig {
minSdkVersion 21
}
compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
}
SDK 19+ additionally requires multiDex. In addition to these gradle config changes, the Application
class must also be changed. See for details: Configure your app for multidex.
groovy
android {
defaultConfig {
multiDexEnabled true
minSdkVersion 19
}
compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
implementation "androidx.multidex:multidex:2.0.1"
}
Hardware Acceleration
Hardware acceleratTop issues
#272IllegalStateException: CameraInstance is not open20 comments · 2017-01-26#693Read Color QR code10 comments · 2022-01-30#92migrate to camera210 comments · 2015-10-20#675ArrayIndexOutOfBoundsException9 comments · 2021-11-22#524QR Code camera frame position9 comments · 2019-12-17#141Is auto flash (like in Camera app) possible?9 comments · 2016-02-26#42Configuration.locale change after back from IntentIntegrator.initiateScan()9 comments · 2015-04-29#652[Android] com.google.zxing.NotFoundException on Tablet Samsung Galaxy A7 (Android 11)8 comments · 2021-09-13
Discussions
#767Release of fixes0 comments · 2025-08-17#749Not all QR codes are read, what is wrong?1 comments · 2024-02-26#745These two codes can not be scanned3 comments · 2023-11-09#743How to install in Android Studio?1 comments · 2023-08-21#737ITF | Interleaved 2 of 51 comments · 2023-05-26#733[INFO PLEASE] - For my app0 comments · 2023-02-03#732Scan until EAN found?1 comments · 2023-01-13#725Vertical Scanning?2 comments · 2022-10-20
Latest release
v4.3.0 v4.3.0 2021-10-25Minimum SDK version 19, but requires additional config (see readme) for < 24 compatibility. Add ScanOptions and ScanContract for use with registerForActivityResult(). Deprecates IntentIntegrator. It is still available, but registerForActivityResult() is recommended instead. Use minimal AndroidX libraries. Use zxing:core 3.4.1 by default. Full Changelog: https://github.com/journeyapps/zxing-android-embedded/compare/v4.2.0...v4.3.0