目录

Integrating the SDK into Your Android Studio Project

Creating a Project

  1. Create an Android Studio project or open an existing one.
  2. Enter the app name and package name, and click Next.

  3. Select an SDK, retain the default settings, and click Next.

  4. Select Empty Activity and click Next.

  5. Enter the file 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'