目录

Integrating the SDK into Your Android Studio Project

Creating an Android Studio project

  1. Create an Android Studio project or open an existing one.
  2. On the Phone and Tablet tab, select Empty Activity, then click Next.

  3. Enter the project name and package name, and click Finish.

Adding Dependencies

  1. Open the build.gradle file in the root directory of your Android Studio project.
  2. Add the Maven repository.
    • Go to allprojects > repositories and configure the Maven repository address for DataSecurity Engine.
    • Go to buildscript > repositories and configure the Maven repository address for DataSecurity Engine.
      allprojects {
          repositories {
              google()
              jcenter()
              // Add the Maven repository.
              maven {url 'https://developer.huawei.com/repo/'}
          }
      }
      buildscript {
          repositories {
              google()
              jcenter()
              // Add the Maven repository.
              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.

  3. Open the app's build.gradle file and add build dependencies to the "dependencies" section.
    dependencies {
    implementation 'com.huawei.security:securitykit:{version}'
    }

    Replace {version} with the actual SDK version number (see Version Change History for details), for example:

    implementation 'com.huawei.security:securitykit:1.1.1'