Build rich Augmented Reality experiences for Android.
DeepAR is an augmented reality SDK used to integrate advanced, Snapchat-like face lenses in iOS, Android and Web apps.
DeepAR Android supports:
- Face filters and masks.
- Glasses virtual try on.
- Background replacement.
- Background blur.
- AR mini-games.
- DeepAR is supported on Android Marshmallow 6.0 (API level 23) and above.
- For Android 12 and above, see the section Android 12+.
See the official example here.
DeepAR is available as AAR dependency installed via maven server or can be downloaded directly from DeepAR Developer Portal.
Add DeepAR maven server as remote repository
in your Android gradle project:
To add a DeepAR dependency to your project, specify a
implementation dependency in the
dependencies block of your module's
- Download the Android package from DeepAR Developer Portal and unzip.
- Create the
libsdirectory in you Android Studio project and copy the
deepar.aarin that directory.
- In the
implementationdependency in the
You can read more about adding dependencies to Android Studio projects here.
In order to use the DeepAR SDK you need to set up a license key for your Android app on developer.deepar.ai.
- Create an account: https://developer.deepar.ai/signup.
- Create a project: https://developer.deepar.ai/projects.
- Add a Android app to the project. Note that you need to specify the
applicationIdof your app.
AR filters are represented by effect files in DeepAR. You can load them to preview the effect.
Places you can get DeepAR effects:
- Download a free filter pack: https://docs.deepar.ai/deep-ar-studio/free-filter-pack.
- Visit DeepAR asset store: https://www.store.deepar.ai/
- Create your own filters with DeepAR Studio.
switchEffect method to load an AR filter from a file.
Please see: https://developer.deepar.ai/customer-agreement
SDK itself doesn't check for Android permissions but certain ones are required for the library to work correctly. Following are the required permissions:
- Camera - Manifest.permission.CAMERA
- External file storage - Manifest.permission.WRITE_EXTERNAL_STORAGE
- Autofocus - android.hardware.camera.autofocus
- Record audio - android.permission.RECORD_AUDIO
It is the responsibility of user provide required permissions.
Android 12 changes the policy of access to native vendor libraries. You can read about it here (see
To ensure all DeepAR features work as expected (especially Background Segmentation), add the following code to your app’s manifest, inside the application tag.
For Pixel devices, you may also need to add this code: