Importing the Face Capture SDK to a Project¶
To include the Face Capture SDK in your application requires the following steps:
- Copy files to the following directories in your Flutter project:
Source File (src=FaceCapture, installation) | Destination Folder (dst) |
---|---|
/src/flutter/aw_face_capture/face_capture.dart | /dst/lib/ |
/src/flutter/aw_face_capture/face_capture.cpp | /dst/ios/Classes/ |
/src/flutter/aw_face_capture/face_capture.h | /dst/ios/Classes/ |
/src/include/aw_face_capture/aw_face_capture_errors.h | /dst/ios/Classes/ |
/src/include/aw_face_capture/aw_face_capture.h | /dst/ios/Classes/ |
/src/include/awlib/aw_types.h | /dst/ios/Classes/ |
/src/include/awlib/aw_types.h | /dst/ios/Classes/awlib/ |
/src/Samples/Profiles/face_capture_foxtrot_client.xml | /dst/example/assets/profiles |
/src/samples/Profiles/face_capture_foxtrot_client_landscape.xml | /dst/android/app/src/main/assets/profiles/ |
/src/lib/android-64-r20-api24/libaw_face_capture.so | /dst/android/src/main/jniLibs/arm64-v8a/ |
/src/lib/android-64-r20-api24/libaw_preface7.so | /dst/android/src/main/jniLibs/arm64-v8a/ |
/src/lib/ios-arm64/AwFaceCaptureFrameWork.framework | /dst/example/ios/ |
- Create a CMakeLists.txt in /dst/android, similiar to the one in /src-demo/flutter/face_capture/android/
cmake_minimum_required(VERSION 3.4.1) # for example
include_directories(../include)
add_library(aw_face_capture SHARED IMPORTED)
set_target_properties(aw_face_capture PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}/libaw_face_capture.so)
add_library(aw_preface SHARED IMPORTED)
set_target_properties(aw_preface PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}/libaw_preface7.so)
add_library(face_capture SHARED ../ios/Classes/face_capture.cpp)
find_library(log-lib log)
target_link_libraries(face_capture aw_face_capture aw_preface ${log-lib})
- Add the following to /dst/android/build.gradle
...
defaultConfig {
minSdkVersion 23
multiDexEnabled true
ndk {
abiFilters 'arm64-v8a'
}
}
defaultConfig {
externalNativeBuild {
cmake {
// Enabling exceptions, RTTI
// And setting C++ standard version
cppFlags '-frtti -fexceptions -std=c++11'
// Shared runtime for shared libraries
arguments "-DANDROID_STL=c++_shared"
}
}
}
externalNativeBuild {
// Encapsulates your CMake build configurations.
cmake {
// Provides a relative path to your CMake build script.
path "CMakeLists.txt"
}
}
sourceSets {
main {
jniLibs.srcDirs = ["libs"]
}
}
- Add the following to /dst/android/src/main/AndroidManifest.xml
...
<uses-permission android:name="android.permission.INTERNET" />
<!-- Permissions options for the `camera` group -->
<uses-permission android:name="android.permission.CAMERA"/>
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https" />
</intent>
</queries>
- Modify /dst/example/android/app/build.gradle to minSdkVersion 23
- Update /dst/pubspec.yaml to include the ffi: ^1.1.2 dependancy
- Perfom the following in “/dst/example/” and “/dst/”:
- “flutter pub get” “flutter pub upgrade”