Skip to content

Android

This is an Android-specific Face SDK installation guide. Before proceeding further, make sure you've read the Installation page and have selected the Core type to install.

Requirements

Installation

Gradle

The Face SDK for Android is available on Maven and can be included via Gradle.

1. Add the Regula Maven repository to your settings.gradle file:

settings.gradle
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()

        maven {
            url "https://maven.regulaforensics.com/RegulaDocumentReader"
        }
    }
}
settings.gradle.kts
1
2
3
4
5
6
7
8
9
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()

        maven { url = uri("https://maven.regulaforensics.com/RegulaDocumentReader") }
    }
}

2. Add the SDK as a dependency to your app-level build.gradle. Make sure transitive is set to true.

  • Core Basic
build.gradle
1
2
3
4
5
6
dependencies {
    implementation ('com.regula.face:api:+@aar') {
        transitive = true
    }
    implementation ('com.regula.face.core:basic:+@aar')
}
build.gradle.kts
1
2
3
4
5
6
dependencies {
    implementation("com.regula.face:api:+@aar") {
        isTransitive = true
    }
    implementation("com.regula.face.core:basic:+@aar")
}
  • Core Match
build.gradle
1
2
3
4
5
6
dependencies {
    implementation ('com.regula.face:api:+@aar') {
        transitive = true
    }
    implementation ('com.regula.face.core:match:+@aar')
}
build.gradle.kts
1
2
3
4
5
6
dependencies {
    implementation("com.regula.face:api:+@aar") {
        isTransitive = true
    }
    implementation("com.regula.face.core:match:+@aar")
}

3. To use Core Match, it's necessary to include the uncompressed faceSdkResource.dat file in the APK. When integrating the Face SDK into a multi-module project, remember to add the code snippet to the android section at the end of the app's Gradle file, rather than within the module itself. If you use Core Basic, skip this step.

Simply add the following code to the android section in the app/build.gradle file:

build.gradle
1
2
3
4
5
6
7
8
9
android {
    ....

    aaptOptions {
        noCompress 'Regula/faceSdkResource.dat'
    }

    ...
}
build.gradle.kts
1
2
3
4
5
6
7
8
9
android {
    ....

    androidResources {
        noCompress += "Regula/faceSdkResource.dat"
    }

    ...
}

Manual Integration

1. Go to our Maven repository.

2. Download the latest Face API version.

3. Find the .pom file there, open it, and check the version of the Common API.

4. Download that Common API version.

5. Get the latest Core version:

6. Copy the downloaded files to the libs folder located at the root directory of your project. If there is no such a folder, create it.

7. Add the libs directory to the settings.gradle file:

settings.gradle
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
    repositories {
        google()
        mavenCentral()
        flatDir {
            dirs 'libs'
        }
    }
}
settings.gradle.kts
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()

        flatDir {
            dirs ("libs")
        }
    }
}

8. Add the downloaded files to the app level build.gradle file of your project, for example:

build.gradle
1
2
3
4
5
dependencies {
    implementation(name:'api-6.1.3021', ext:'aar')  // face api
    implementation(name:'api-7.1.1535', ext:'aar')  // common
    implementation(name:'fcore-6.1.407', ext:'aar')
}
build.gradle.kts
1
2
3
dependencies {
    implementation(fileTree(mapOf("dir" to "libs", "include" to listOf( "api-6.1.3021.aar", "api-7.1.1535", "fcore-6.1.407"))))
}

9. Sync the project.

Next Step