Android Barcode Scanner SDK - Getting Started
Scanbot Barcode Scanner SDK Dependencies
The Scanbot Barcode Scanner 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 Barcode Scanner SDK maven repos:
maven { url "https://nexus.scanbot.io/nexus/content/repositories/releases/" }
maven { url "https://nexus.scanbot.io/nexus/content/repositories/snapshots/" }
}
}
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:
implementation "io.scanbot:scanbot-barcode-scanner-sdk:$scanbotBarcodeSdkVersion"
Get the latest $scanbotBarcodeSdkVersion
from the Changelog.
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.
Optional: ABI Settings
The Scanbot Barcode Scanner 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 ARM 64-bit architecture (used in most common devices).armeabi-v7a
: Native libs for the ARM 32-bit architecture (older devices).x86
andx86_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.
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 LicenseWhat do you think of this documentation?
What can we do to improve it? Please be as detailed as you like.