Getting started
Sample Project
If you prefer sample projects over documentation, check out our Docutain SDK Android Sample on Github.
Docutain SDK Dependencies
The Docutain SDK for Android is distributed through Maven repositories, so make sure you have added mavenCentral() in your settings.gradle file:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
If you are using old syntax for specifying repositories, make sure that mavenCentral() is added in your top level build.gradle file:
allprojects {
repositories {
google()
mavenCentral()
}
}
Afterwards, you can add dependencies to your build.gradle file:
Photo Payment
def docutainSdkVersion = '1.10.0.0'
implementation("de.docutain:Docutain-SDK-UI:$docutainSdkVersion")
implementation("de.docutain:Docutain-SDK-DataExtraction:$docutainSdkVersion")
Document Scanner, Data Extraction, OCR
def docutainSdkVersion = '1.10.0.0'
//For Document Scanner components
implementation("de.docutain:Docutain-SDK-UI:$docutainSdkVersion")
//For Data Extraction and OCR (Text Recognition) components
implementation("de.docutain:Docutain-SDK-DataExtraction:$docutainSdkVersion")
The Android SDK includes support for the following CPU architectures: x86, x86_64, armeabi-v7a, arm64-v8a.
If you’d like to optimize the size of your app, you can either:
- generate one APK file per architecture
- or use the Android App Bundle upload format so Google Play can serve optimized APKs for each user’s device configuration.
Native debug symbols are included as part of the SDK. These symbols are generally stripped in the release builds of your app. This isn’t the case for debug builds, for which you may see a larger size increase.
You can also exclude certain CPU architecture (ABIs) by using abiFilters in your build.gradle:
android {
...
defaultConfig {
...
ndk {
// a typical production (release) configuration:
abiFilters "armeabi-v7a", "arm64-v8a"
}
}
}
CompileSdk and MinSdk
The compileSdk of your app needs to be set to 36 or greater and the minSdk to 23 or greater:
android {
compileSdk 36
defaultConfig {
minSdk 23
}
}
Note that updating the compileSdk (which allows newer APIs to be used) can be done seperately from updating targetSdk. So this should have no negative impact on your app.
Kotlin
The Docutain SDK is built with Kotlin 2.1.20. If your app uses Kotlin, it needs to use Kotlin 2.0 or higher. We recommend Kotlin 2.1.20:
plugins {
id 'org.jetbrains.kotlin.android' version '2.1.20' apply false
}
Android Gradle Plugin
To run the Docutain SDK on Android, your projects needs to have AGP (Android Gradle Plugin) Version 8.9.1 or higher. This is the first AGP version that supports compileSdk 36.
If you are currently using an AGP version lower than 8.9.1, you need to upgrade to at least 8.9.1. We recommend to do this with Android Studio. Open your project with Android Studio and use the AGP Upgrade Assistant.
More details on upgrading AGP
When upgrading AGP version, you might get an error similar to the following:

Starting with AGP version 8, each project needs to define a namespace. The Docutain SDK already supports this, but you might use some other 3rd party dependencies that have not been upgraded to using namespaces yet.
You can upgrade all your packages to the latest version in the build.gradle and see if this solves the issue.
If not, you need to add the highlighted part to your project's build.gradle:
allprojects {
repositories {
google()
mavenCentral()
}
subprojects {
afterEvaluate { project ->
if (project.hasProperty('android')) {
project.android {
if (namespace == null) {
namespace project.group
}
}
}
}
}
}
Memory settings
Your application will work with high-resolution images. To avoid OutOfMemoryError exceptions it is highly recommended to set android:largeHeap="true" in the <application> element of your AndroidManifest.xml file.
<application android:largeHeap="true" ...>
...
</application>
Camera permission and feature
The Docutain SDK declares the android.permission.CAMERA permission and the android.hardware.camera feature in its manifest. Both are merged into the manifest of your app automatically, so you do not need to declare them yourself. The document scanner also requests the camera permission from the user at runtime.
As the camera feature is declared as required, Google Play does not offer your app on devices without a rear-facing camera. If scanning is only an optional part of your app and your app should be available on these devices as well, declare the camera features as not required in your AndroidManifest.xml file. tools:replace is necessary to override the declaration of the Docutain SDK. The autofocus feature is implied by the camera permission, so it needs to be declared as not required as well.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-feature
android:name="android.hardware.camera"
android:required="false"
tools:replace="android:required" />
<uses-feature
android:name="android.hardware.camera.autofocus"
android:required="false" />
...
</manifest>
In this case, make sure to start the document scanner only on devices that have a camera.