Add the SDK to Your App

This guide shows you how to add the Scandit Data Capture SDK to current existing project.

Prerequisites

  • The latest stable version of the Android SDK (for example through the latest Android Studio).

  • An Android project with target SDK version 23 (Android 6, Marshmallow) or higher.

  • A valid Scandit Data Capture SDK license key. You can sign up for a free test account at ssl.scandit.com.

Note

Devices running the Scandit Data Capture SDK need to have a GPU or the performance will drastically decrease.

Get a License Key

  1. If you don’t have a Scandit account yet, create a free test account at ssl.scandit.com.

  2. Sign in to your account at ssl.scandit.com/sessions/new.

  3. Select “License Keys” from the left-hand menu.

  4. If you don’t have a license key for your app yet, click “Create native SDK license key” and enter the bundle ID for your project.

  5. Copy the license key.

If you have a paid subscription, please reach out to support@scandit.com if you need a new license key.

Add the SDK

Scandit Data Capture SDK is distributed as AAR libraries in the official Scandit maven repository.

You will always need to add a reference to com.scandit.datacapture:core, which contains the shared functionality used by the other data capture modules. If you’re using textcapture-related functionalities, make sure to also add a reference to com.scandit.datacapture:text-base. In addition, depending on the data capture task, you will need a reference to:

  • com.scandit.datacapture:barcode (ScanditBarcodeCapture API) if you want to use barcode-related functionality such as barcode capture or MatrixScan.

  • com.scandit.datacapture:parser (ScanditParser API) if you want to parse data strings, e.g. as found in barcodes, into a set of key-value mappings.

  • com.scandit.datacapture:text (ScanditTextCapture API) if you want to use text recognition (OCR) functionality, often combined with barcode scanning to deliver simultaneous barcode and text capture.

  • com.scandit.datacapture:id (ScanditIdCapture API) if you want to scan personal identification documents such as identity cards, passports or visas.

You can safely remove barcode, parser, text or id dependencies if you are not going to use their features.

Gradle

Add mavenCentral() repository in build.gradle file:

repositories {
  mavenCentral()
}

Add the necessary artifacts as dependencies to the app’s build.gradle:

dependencies {
  implementation "com.scandit.datacapture:core:[version]"
  implementation "com.scandit.datacapture:barcode:[version]"
  implementation "com.scandit.datacapture:parser:[version]"
  implementation "com.scandit.datacapture:text-base:[version]"
  implementation "com.scandit.datacapture:text:[version]"
  implementation "com.scandit.datacapture:id:[version]"
}

Latest [version] is 6.17.2 and can be found on Sonatype.

Note

The core module depends on okhttp version 4.9.0. If your project already implements a differnet version of okhttp (within the supported version range specified in the requirements page), make sure to exclude the group from the gradle implementation of the core module.

implementation("com.scandit.datacapture:core:[version]") {
  exclude group: "com.squareup.okhttp3"
}

Maven

Add the mavenCentral repository in pom.xml file:

<repositories>
  <repository>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>central</id>
      <name>Maven Central</name>
      <url>https://repo1.maven.org/maven2</url>
  </repository>
</repositories>

Add the necessary artifacts as dependencies:

<dependency>
  <groupId>com.scandit.datacapture</groupId>
  <artifactId>core</artifactId>
  <version>[version]</version>
</dependency>

<dependency>
  <groupId>com.scandit.datacapture</groupId>
  <artifactId>barcode</artifactId>
  <version>[version]</version>
</dependency>

<dependency>
  <groupId>com.scandit.datacapture</groupId>
  <artifactId>parser</artifactId>
  <version>[version]</version>
</dependency>

<dependency>
  <groupId>com.scandit.datacapture</groupId>
  <artifactId>text-base</artifactId>
  <version>[version]</version>
</dependency>

<dependency>
  <groupId>com.scandit.datacapture</groupId>
  <artifactId>text</artifactId>
  <version>[version]</version>
</dependency>

<dependency>
  <groupId>com.scandit.datacapture</groupId>
  <artifactId>id</artifactId>
  <version>[version]</version>
</dependency>

Latest [version] can be found here.

Manually Add the Library to your Project

You will always need to add a reference to ScanditCaptureCore.aar, which contains the shared functionality used by the other data capture modules. In addition, depending on the data capture task, you will need a reference to:

  • ScanditBarcodeCapture API if you want to use barcode-related functionality such as barcode capture or MatrixScan.

  • ScanditParser API if you want to parse data strings, e.g. as found in barcodes, into a set of key-value mappings.

  • ScanditTextCapture API if you want to use text recognition (OCR) functionality, often combined with barcode scanning to deliver simultaneous barcode and text capture.

  • ScanditIdCapture API if you want to scan personal identification documents such as identity cards, passports or visas.

If your project already has a local flatDir repository, add the AAR files to that folder. If you do not have a flatDir respository yet, create a new one in your build.gradle file as illustrated below:

repositories {
  flatDir {
    dirs '/path/to/folder/containing/the/aar/file'
  }
}

Add the .aar libraries as dependencies to your build.gradle file (below an example with BarcodeCapture and TextCapture)

dependencies {
  api(name:'ScanditBarcodeCapture', ext:'aar')
  api(name:'ScanditTextCaptureBase', ext:'aar')
  api(name:'ScanditTextCapture', ext:'aar')
}

External dependencies

The Scandit Data Capture SDK modules depend on a few standard libraries that you can find listed below. If you are including the Scandit Data Capture SDK through Gradle or Maven, all of these dependencies are automatically pulled in and there is no need for you to do anything further. If on the other hand you are directly adding the AAR files to the project, you will have to add these dependencies yourself.

Module

Dependencies

ScanditCaptureCore.aar

  • org.jetbrains.kotlin:kotlin-stdlib:[version]

  • androidx.annotation:annotation:[version]

  • com.squareup.okhttp3:okhttp:4.9.2

ScanditBarcodeCapture.aar

  • org.jetbrains.kotlin:kotlin-stdlib:[version]

  • androidx.annotation:annotation:[version]

ScanditParser.aar

No dependencies

ScanditTextCaptureBase.aar

No dependencies

ScanditTextCapture.aar

  • org.jetbrains.kotlin:kotlin-stdlib:[version]

  • androidx.annotation:annotation:[version]

ScanditIdCapture.aar

  • org.jetbrains.kotlin:kotlin-stdlib:[version]

  • androidx.annotation:annotation:[version]

Additional Information

Next steps

You are now ready to tackle the following guides: