Skip to main content

Getting Started | Android Barcode Scanner

Scanbot Barcode Scanner SDK Dependencies#

The Scanbot Barcode Scanner SDK for Android is distributed through our private Maven repository which you have to specify in your top-level build.gradle file:

allprojects {    repositories {        google()        mavenCentral()
        // Scanbot Barcode Scanner SDK maven repos:        maven {            url 'https://nexus.scanbot.io/nexus/content/repositories/releases/'        }        maven {            url 'https://nexus.scanbot.io/nexus/content/repositories/snapshots/'        }    }}

Afterwards, you can add a dependency to your project:

implementation "io.scanbot:scanbot-barcode-scanner-sdk:$scanbotBarcodeSdkVersion"

Get the latest $scanbotBarcodeSdkVersion from the Changelog.

Manual Download of the Artifacts

If you need to download and work with the artifacts (.aar files) of the Scanbot SDK manually, please refer to our download tool in this repo: link.

Enable Multidex#

Make sure you have enabled multidex by setting multiDexEnabled to true in your module-level build.gradle file (e.g. app/build.gradle):

android {  ...  defaultConfig {    ...    multiDexEnabled true  }}

ABI Settings#

The Scanbot Barcode Scanner SDK uses native libraries under the hood and supports the following ABIs: armeabi-v7a, arm64-v8a, x86 and x86_64.

Please check and add/adjust the abiFilters configuration in your module-level build.gradle file accordingly:

android {  ...  defaultConfig {    ...    ndk {      // a typical production configuration:      abiFilters "armeabi-v7a", "arm64-v8a"    }  }}
  • arm64-v8a: Native libs for the ARM 64-bit architecture (used in most common devices).

  • armeabi-v7a: Native libs for the ARM 32-bit architecture (older devices).

  • x86 and x86_64: In most cases both "x86" architectures can be removed for the release (production) build, since they are only used on emulators and on some rare devices with the Intel Atom architecture.

If you need to support all architectures, we highly recommend using the new Android App Bundle approach when it comes to publishing apps.

Tuning the Android Manifest#

Camera Permission#

Declare that your app needs camera permission by listing the permission android.permission.CAMERA in the AndroidManifest.xml file:

<uses-permission android:name="android.permission.CAMERA" /><uses-feature android:name="android.hardware.camera" />

Since Android 6.0 (API level 23) you also have to implement a suitable permission requesting and handling at runtime. For more details please see the Android docs "Request App Permissions" as well as our basic example implementation.