Getting started
Docutain SDK Dependencies
The Docutain Barcode Scanner 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 the dependency to your build.gradle
file:
def docutainBarcodeSdkVersion = '1.0.0.5'
implementation("de.docutain:Docutain-SDK-Barcode:$docutainBarcodeSdkVersion")
CompileSdk
The compileSdk
of your app needs to be set to 34
or greater. Note that updating the compileSdk
(which allows newer APIs to be used) can be done seperately from updating targetSdk
and minSdk
. So this should have no negative impact on your app.
Android Gradle Plugin
To run the Docutain SDK on Android, your projects needs to have AGP (Android Gradle Plugin) Version 8.0.2
or higher.
If you are currently using an AGP version lower than 8.0.2, you need to upgrade to at least 8.0.2. We recommend to do this with Android Studio. Open the native Android project of your Flutter 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
}
}
}
}
}
}
Camera Permission
Declare the following permission in your AndroidManifest.xml
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera"/>
Runtime permission for camera is handled automatically by the Docutain SDK.