Skip to main content

Android Document Scanner SDK - Getting Started

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 "https://nexus.scanbot.io/nexus/content/repositories/releases/" }
maven { url "https://nexus.scanbot.io/nexus/content/repositories/snapshots/" }
}
}
caution

For new Android projects created in Android Studio dependencyResolutionManagement repositories block in settings.gradle could be used by default. If this feature is used with RepositoriesMode.FAIL_ON_PROJECT_REPOS mode for the central declaration of repositories, make sure you have added the Scanbot SDK repositories only in this specific block (instead of using allprojects repositories block in the build.gradle file):

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()

// Scanbot 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:

def scanbotSdkVersion = 'LATEST_SCANBOT_SDK_VERSION'

Get the latest $scanbotSdkVersion from the Changelog.

For Package I features:

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

Or alternatively for Package III features:

implementation("io.scanbot:sdk-package-3:$scanbotSdkVersion")
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.

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 .

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.

Optional: 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 the 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 the Scanbot SDK.

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

Want to scan longer than one minute?

Generate your free "no-strings-attached" Trial License and properly test the Scanbot SDK.

Get your free Trial License

What do you think of this documentation?