AI Effects
  • iOS
  • Android : Java
  • Overview
  • Release notes
  • SDK downloads
  • Demo app
  • Sample codes
  • Getting started
    • Integrate the SDK
    • Import resources and models
    • Online authentication
    • Implement basic image processing
  • Guides
    • Face beautification
    • Face shape retouch
    • Beauty makeups
    • Background segmentation
    • Face detection
    • Stickers
    • Filters
  • Tutorials
  • Error codes
  • Documentation
  • AI Effects
  • Sample codes

Run the sample code

Last updated:2022-04-19 16:17

Prerequisites

Before you begin, make sure you complete the following steps:

  • Contact the ZEGO team to get the latest version of the SDK and sample code.
  • Contact the ZEGO team to get the AppID and AppSign for online privilege authentication.
  • Get the unique license file of the Effects SDK. For details, see Online privilege authentication.

Make sure your development environment meets the following requirements:

  • Android Studio 4.0 or later.
  • Android SDK 30, Android SDK Platform-Tools 30.x.x or later.
  • An Android device or emulator that is running on Android 9.0 (or later) and supports audio and video. We recommend you use a real device. If you use a real device, enable the Developer Options and USB Debugging.
  • When compiling the sample code for the first time, Android Studio may take a while to download the missing dependencies or build tools.
  • We recommend you use the following Gradle version and dependent libraries. For more information about Gradle, see Gradle Services .
    • Gradle: 6.8.1 (specified in the file project/gradle/wrapper/gradle-wrapper.properties).
    • Gradle Android plugin: 4.1.2 (specified in the file project/build.gradle).

Run the sample code

  1. If you haven't done so already, download and install Android Studio.
  1. Open Android Studio and click Open an existing Android Studio project.

    /Pics/ZegoEffects/Android/android_studio_open_project.png

  2. Select the ZegoEffectsExample folder in the unzipped sample code package, and click Open.

    /Pics/ZegoEffects/Android/open_effects_android_example.png

  3. Specify the license information (AppID and AppSign), which is required for initializing the SDK.

    a. Obtain the AppID and AppSign according to the 2 Prerequisites.

    b. Modify the ZegoLicense.java file in the ZegoEffectsExample/SDKManager/src/main/java/im/zego/zegoeffectsexample/sdkmanager directory to specify the license information.

    /Pics/ZegoEffects/Android/specify_license_JAVA_EN.png

    c. Find the "app/build.gradle" file and modify applicationId to the package name used when applying for license.

  1. Connect your Android device (make sure Developer options and USB debugging are enabled) to your development computer. Once the device is successfully connected, it will appear in the target device drop-down menu in Android Studio. Then, you can select it as the target device to run the sample code.

    Before the device is connected:

    /Pics/ZegoEffects/Android/android_studio_no_device.png

    After the device is connected:

    /Pics/ZegoEffects/Android/android_studio_has_device.png

    • When you connect your PC to an Android device, a message will pop up on most devices. The message varies according to Android vendors. You can select USB mode based on the actual situation.
    • When the Android device is connected to your PC, you will need to enable developer mode and USB debugging on the device as required (different Android devices can be enabled in different ways). You can also search for the methods when needed. For example, if the developer mode and USB debugging features are not enabled on a certain device, you can search for Developer mode on XX device for the specific tutorial.
  1. Click the Run button to build and run the sample code.
    /Pics/ZegoEffects/Android/android_studio_build_and_run.png
Page Directory