目录

Integrating the LocalAuthentication SDK

If you are using Android Studio, you can integrate the LocalAuthentication SDK via the Maven repository. You can also download the LocalAuthentication SDK and integrate it into the project. Before you start developing an app, integrate the LocalAuthentication SDK into your Android Studio project first.

Using the Maven Repository for Integration

  1. Open the Android Studio project-level build.gradle file and add a Maven repository address.
    allprojects {
        repositories {
            google()
            jcenter()
            // Add a Maven repository address.
            maven {url 'https://developer.huawei.com/repo/'}
        }
    }

    The Maven repository address cannot be accessed from a browser. It can only be configured in the IDE. If there are multiple Maven repositories, add the Maven repository address of Huawei as the last one.

  2. Open the module-level build.gradle file and add SDK build dependencies to the file.
    dependencies {
        /* Add SDK build dependencies */
        implementation 'com.huawei.security:localauthentication:{version}'
    }

    localauthentication indicates the Huawei's LocalAuthentication SDK. Replace {version} with the actual SDK version number. For details about version numbers, refer to Version Change History. Example: implementation 'com.huawei.security:localauthentication:1.1.1'

  3. After completing the preceding configuration, click the synchronization icon on the toolbar to synchronize the build.gradle file and download related dependencies to the local host.

    If an error occurs, check the network connection and the configuration in the build.gradle file.

Downloading and Integrating the SDK

  1. Download the LocalAuthentication SDK from HUAWEI Developers. For details, refer to SDK Download.
  2. Save the downloaded localauthentication-xxx.aar package to the libs directory of the project.

  3. Add a dependency directory and a build dependency on the SDK in the app-level build.gradle file.
    repositories{
        flatDir{
            /* Add a dependency directory */
            dirs 'libs'
        }
    }
    dependencies{
        /* Add SDK build dependencies */
        implementation(name:'localauthentication-1.1.1',ext:'aar')
    }