Skip to content

[EN] Deploy a Demo

gujiayang edited this page Feb 26, 2017 · 6 revisions

This tutorial is for developers using Android Studio. Please refer to Deploy a Demo (Eclipse) if you are using Eclipse.

  1. Download Demo Source Code

git clone https://github.com/FacePlusPlus/MegviiFacepp-Android-SDK.git
  1. Import Face SDK aar File

  • Open Android Studiot, choose Open an existing Android Studio project, open FaceppDemo folder;

Face++ project configure

  • Android Studio will then prompt that cannot find aar file, so the next step will be importing aar file;

  • Copy the compiled Face SDK aar file to FaceppDemo/FaceppDemoUI/libs folder: (The SDK downloaded from Face++ website contains compiled Face SDK aar file, which you can directly use)

Face++ configure

  • Copy algorithm model to FaceppDemo/FaceppDemoUI/src/main/res/raw folder.

Face++ configure

  1. Set License Configuration

  • Add Online Licensing Manager SDK

    • [Online Licensing version SDK] Copy compiled Online Licensing Manager SDK aar file to FaceppDemo/FaceppDemoUI/libs folder: (The SDK downloaded from Face++ website contains compiled Online Licensing Manager SDK aar file, which you can directly use)

    Face++ configure

    • [Offline Licensing version SDK] Comment out the code about importing LicMgr SDK in FaceppDemo/build.gradle; And in FaceppDemo/app/src/main/java/com/facepp/demo/LoadingActivity.java, comment out the code after if block in void network() function;

Face++ configure

Face++ configure

  • Add API_KEY and API_SECRET

    • [Online Licensing version SDK] Add your api_key and api_secret into FaceppDemo/FaceppDemoUI/src/main/java/com/facepp/library/util/Util.java (api_key and api_secret are credentials to use Face++ cloud services, which can be accessed in Face++ Console; Check the tutorial to learn about how to get api_key and api_secret);

    Face++ configure

    • [Offline Licensing version SDK] Assign null value "" to API_KEY and API_SECRET in FaceppDemo/FaceppDemoUI/src/main/java/com/facepp/library/util/Util.java;

Face++ configure

  1. Set Bundle ID (ApplicationID)

  • Set the bundle-id in this project as the one you submit in Face++ Console. For how to set bundle-id in Face++ Console, check the tutorial;

  • Set appliactionId in FaceppDemo/app/build.gradle(Module.app) as corresponding bundle-id, then sync gradle configurations;

Face++ configure

  1. Run Demo App

Connect your device with computer, click run button, you will then be able to run demo app on your device.

Face++ Demo run

  1. Next Step

Congratulations! You've finished this tutorial. You can refer to Face++ Android SDK API, to learn more about how to use Face++ algorithms to power your applications.