journeyapps /zxing-android-embedded

Barcode scanner library for Android, based on the ZXing decoder

★ 5,932⑂ 1,283👁 169⑃ 113● 612▤ 9
JavaApache-2.0Created 2012-11-28journeyapps.com/
Download: v4.3.0v4.3.0 ↓4.3.02021-10-25
-1
Daily
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 accelerat

Top issues

Discussions

Latest release

v4.3.0 v4.3.0 2021-10-25
Minimum 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

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON