Skip to main content

Getting started | Android Document Scanner

Scanbot SDK Dependencies#

The Scanbot 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 SDK maven repos:        maven {            url ''        }        maven {            url ''        }    }}

Afterwards, you can add a dependency to your project:

For Package I features:

implementation "io.scanbot:sdk-package-1:$scanbotSdkVersion"

Or alternative for Package II features:

implementation "io.scanbot:sdk-package-2:$scanbotSdkVersion"

Get the latest $scanbotSdkVersion 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 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 arm64-v8a architecture are available since version 1.31.0 of Scanbot SDK. Previous versions of Scanbot SDK use armeabi-v7a libs since they are fully compatible with "arm64".

  • 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. The support for the x86_64 architecture was added in v1.50.0 of Scanbot SDK.

If you need to support all architectures, we highly recommend to use 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=""/>

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 .

Memory Settings#

Since your application will work with high-resolution images it is strongly recommended to add the property android:largeHeap="true" in the <application> element of your AndroidManifest.xml file, especially for Android <= 7.x. Processing hi-res images is a memory intensive task and this property will ensure your app has enough heap allocated to avoid OutOfMemoryError exceptions.

<application android:largeHeap="true" ...>    ...</application>

๐Ÿ‘‰ We also recommend checking out this article Managing Bitmap Memory of the Android docs.