Skip to content

[EN] Deploy a Demo (Eclipse)

gujiayang edited this page Feb 26, 2017 · 4 revisions

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

  1. Download Demo Source Code

  • For Linux or Mac OS users, use the following command:
git clone https://github.com/FacePlusPlus/MegviiFacepp-Android-SDK.git
  • For Windows 7 (or later version) users, and who have a NTFS drive and have installed git-for-windows, turn to git-for-windows 的Symbolic Links,and use the following command:
git clone -c core.symlinks=true https://github.com/FacePlusPlus/MegviiFacepp-Android-SDK.git
  • For other Windows users, or those who perfer not to use git-for-windows Symbolic Links, use the following command. And then double click to run project-copy.bat in the EclipseFaceppDemo/FaceppDemo/ folder, then run project-copy.bat in the EclipseFaceppDemo/FaceppDemoUI/ folder:
git clone https://github.com/FacePlusPlus/MegviiFacepp-Android-SDK.git

Face++ configure

  1. Import Face SDK jar + *.so File

  • Open Eclipse,choose File > Import > Android > Existing Android Code Into Workspace,choose EclipseFaceppDemo folder;

    Face++ configure

    • There will be two projects imported into Eclipse. FaceppDemoUI is a library project, while FaceppDemo is a project using this library, which only contains a launching page;
    • It is suggested that you reset the project name when importing project, in order to avoid name collision with existing workspace project;
  • Copy the compiled Face SDK jar + *.so file to EclipseFaceppDemo/FaceppDemoUI/libs folder; (android-support-v4.jar is contained by default. The SDK downloaded from Face++ website contains compiled *Face SDK jar + .so file, which you can directly use)

  • Copy algorithm model to EclipseFaceppDemo/FaceppDemoUI/res/raw folder.

Face++ configure

  1. Set License Configuration

  • Add Online Licensing Manager SDK

    • [Online Licensing version SDK] Copy compiled Online Licensing Manager SDK jar + *.so file to EclipseFaceppDemo/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 after if block in void network() function in EclipseFaceppDemo/FaceppDemo/src/com/facepp/demo/LoadingActivity.java; (Also comment out code related to import)

Face++ configure

  • Add API_KEY and API_SECRET

    • [Online Licensing version SDK] Add your api_key and api_secret into EclipseFaceppDemo/FaceppDemoUI/src/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 EclipseFaceppDemo/FaceppDemoUI/src/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 package="..." in EclipseFaceppDemo/FaceppDemo/AndroidManifest.xml 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

  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.