Documentation
AI_Vision AI Effects
Documentation
Demo APP
SDK Center
API Center
FAQ
Code Market
Console
Sign Up
Log In
中文站 English
  • Documentation
  • AI Effects
  • Getting started
  • Integrate the SDK

Integrate the SDK

Last updated:2025-04-07 19:19

Prerequisites

Make sure your development environment meets the following requirements:

  • Android Studio 2.1 or later
  • Android SDK 25, Android SDK Build-Tools 25.0.2, Android SDK Platform-Tools 25.x.x, or later
  • An Android device or emulator running on Android 6.0 or later (we recommend you use a real device)

Create a new project

  1. Launch Android Studio, and in the Welcome to Android Studio window, click Create New Project.

    If you have a project already opened, select File > New > New Project.

  2. In the Configure your project window, fill in the project name and the location to save the project.

  3. Use the default settings for other fields, then click Next, and then click Finish to complete the project creation.

Import the SDK

Currently, the SDK supports these Application Binary Interfaces (ABIs): arm64-v8a, armeabi-v7a, and x86_64.

To import the SDK, do the following:

  1. Contact the ZEGO team to get the latest version of the SDK.

  2. Extract the SDK package to your project directory, for example, app/libs.

    /Pics/AI_Vision/QuickStarts/integration_Android_1.png

  3. Open the app/build.gradle file, and add references to the SDK.

    • In the defaultConfig block, add the ndk block to specify the supported ABIs.

      /Pics/AI_Vision/QuickStarts/integration_Android_2.png

      ndk {
          abiFilters'armeabi-v7a','arm64-v8a','x86_64'
      }
    • In the android block, add the sourceSets block to specify the directory where the SDK library files are located.

      The libs directory in the following sample code is just an example. Use the actual path according to your project setup.

      sourceSets {
          main {
              jniLibs.srcDirs = ['libs']
          }
      }
    • In the dependencies block, add the following line to import all JAR files under the libs directory.

      implementation fileTree(dir:'libs', include: ['*.jar'])

Add app permissions

Add the following permissions in the app/src/main/AndroidManifest.xml file for your app to access the devices according to your app's requirements.

For Android SDK versions 33 and above, OpenCL is not enabled by default, which means developers need to actively enable OpenCL if they wish to use it.

<!-- Required permissions for SDK -->
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<!-- Part of the permissions that App needs to use -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />


<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />

<!-- For Android SDK 33 or higher, you need to execute this statement to enable OpenCL-->
<uses-library android:name="libOpenCL.so" android:required="false"/>

Request runtime permissions: Android 6.0 requires certain important permissions to be obtained at runtime. So, besides declaring permissions in your app's AndroidMainfest.xml file, you also need to add the following code to request the permissions at runtime.

Note: requestPermissions is a method of the Activity.

String[] permissionNeeded = {
    "android.permission.CAMERA"};

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    if (ContextCompat.checkSelfPermission(this, "android.permission.CAMERA") != PackageManager.PERMISSION_GRANTED) {
        requestPermissions(permissionNeeded, 101);
    }
}

Prevent code obfuscation

In the proguard-rules.pro file, add the following line to prevent the classes of the ZegoEffects SDK from being obfuscated.

-keep class **.zego.**{*;}

Related documents

  • How to obtain the SDK stack traces?
  • How to obtain the SDK logs?
Page Directory
  • Free trial
  • 提交工单
    咨询集成、功能及报价等问题
    电话咨询
    400 1006 604
    Get Consulting
    Scan Wechat QR code