Configure MobbScan Android SDK
Migrating from previous versions
If you are upgrading to version 2.29.x or later and were previously using MobbScan SDK via .aar files, please follow our Migration to 2.29.x guide.
Requirements
- Device running Android 5.0 (API level 21) or later
- Camera with autofocus capability
compileSdk35
Configure the Maven repository
Add the MobbScan Maven repository to your project's build.gradle file:
repositories {
mavenCentral()
maven {
url = uri("https://repository.mobbeel.com/repository/release/")
credentials {
username = "YOUR_CLIENT_ID"
password = "YOUR_CLIENT_PASSWORD"
}
}
}
Important: Replace
YOUR_CLIENT_IDandYOUR_CLIENT_PASSWORDwith the credentials provided by Mobbeel.
Add the SDK dependency
Add the MobbScan SDK dependency to your app module's build.gradle:
dependencies {
implementation 'com.mobbeel:mobbscan-sdk-android:2.36.0'
}
Optional modules
Video recording (unattended video verification)
If you want to record videos during the verification process, add the video module:
dependencies {
implementation 'com.mobbeel:mobbscan-sdk-android:2.36.0'
implementation 'com.mobbeel:mobbscan-video-android:2.36.0'
}
NFC reading (passport and Spanish ID card v3)
If you want to read NFC chips from passports or Spanish ID cards, add the NFC extension:
dependencies {
implementation 'com.mobbeel:mobbscan-sdk-android:2.36.0'
implementation 'com.mobbeel:mobbscan-nfc-extension-android:2.36.0'
}
Required permissions
Add the following permissions to your AndroidManifest.xml:
<!-- Required to check licenses -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- Required to capture images for scanning -->
<uses-permission android:name="android.permission.CAMERA" />
For video recording, also add:
<!-- Required to record audio during video verification -->
<uses-permission android:name="android.permission.RECORD_AUDIO" />
For NFC reading, also add:
<!-- Required to access NFC chip -->
<uses-permission android:name="android.permission.NFC" />
<uses-feature android:name="android.hardware.nfc" android:required="true" />
ProGuard configuration
If you enable ProGuard or R8 in your release builds, add the following rules to your proguard-rules.pro file:
# MobbScan rules
-keep class com.mobbeel.** { *; }
-dontwarn com.mobbeel.**
-keepattributes *Annotation*, InnerClasses
-dontnote retrofit2.Platform
# Gson rules
-keep class com.google.gson.** { *; }
-dontwarn sun.misc.**
-keep class com.google.gson.stream.** { *; }
# EventBus rules
-keepclassmembers class * {
@org.greenrobot.eventbus.Subscribe <methods>;
}
-keep enum org.greenrobot.eventbus.ThreadMode { *; }
If you use the video module, also add:
# Twilio Video rules
-keep class tvi.webrtc.** { *; }
-keep class org.webrtc.** { *; }
-keep class com.twilio.video.** { *; }
-keepattributes InnerClasses
If you use the NFC module, also add:
# NFC rules
-keep class net.sf.scuba.smartcards.** { public *; }
-dontwarn de.tsenger.androsmex.**
-dontwarn jj2000.**
-dontwarn com.fasterxml.jackson.**
Play Store distribution
If you want to reduce the size of your final APK, you can configure ABI filters:
android {
defaultConfig {
ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a'
}
}
}
Example configuration
Here is a complete example of a build.gradle configuration:
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
namespace 'com.example.mobbscanapp'
compileSdk 35
defaultConfig {
applicationId "com.example.mobbscanapp"
minSdk 21
targetSdk 35
ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a'
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
maven {
url = uri("https://repository.mobbeel.com/repository/release/")
credentials {
username = "YOUR_CLIENT_ID"
password = "YOUR_CLIENT_PASSWORD"
}
}
}
dependencies {
implementation 'com.mobbeel:mobbscan-sdk-android:2.36.0'
}
Next steps
Once configured, follow the Getting Started guide to initialize the SDK and start scanning documents.
