Express-Video SDK
  • Platform
  • Framework / Engine
  • iOS
  • Android
  • macOS
  • Windows
  • Linux
  • Web
  • WeChat Mini Program
Sample Code
Download
Note

1 Sample code running guide

1.1 Prepare the environment

Please ensure that the development environment meets the following technical requirements (the following instructions are based on MacOS development computers as examples):

  • Android Studio 2.1 or above.
  • Android SDK 28 and Android SDK Platform-Tools 28.*.* have been downloaded.
  • Android devices or emulators with Android version not lower than 4.0.3 and support audio and video (recommended to use a real device), if it is a real device, please enable the "Allow debugging" option.
  • The Android device is connected to the Internet.

When you compile the sample code for the first time, there is no corresponding dependent library or build tool, Android Studio will download the sample code by itself, which may take a long time, please be patient.

It is recommended to download a specific gradle and the required dependent libraries. Please make sure that the development computer is connected to the Internet and can be accessed normally https://services.gradle.org .

The relevant versions of gradle used in the sample code are as follows:

  • gradle: 4.6 (can be viewed in the project/gradle/wrapper/gradle-wrapper.properties file)
  • gradle Android plugin: 3.2.1 (can be viewed in the project/build.gradle file)

1.2 Prerequisites

Please go to Console Management Console to register an account and apply for the AppID and AppSign required to initialize the SDK. For the application process, please refer to ZEGO Admin Console User Manual.

1.3 Run the sample code

  1. Find the Android Studio software icon on the development computer.

    If the software is not installed on the development computer, you can refer to the following operations:

    Method 1: Log in to Android Studio official website to download and install Android Studio and its related SDK Tools. Due to domestic operator network restrictions and other reasons, the developer needs to ensure that the machine can connect to the website. If you cannot access it, it is recommended to choose method 2.

    Method 2: Use a search engine to search for Android Studio download, Android Studio installation and Android Studio SDK Tools installation, find downloadable source websites, and install related software and tools.

  2. Open the Android Studio software, and click Open an existing Android Studio project.

  3. Select the downloaded sample code ./video (Video SDK Demo) or ./audio (Audio SDK Demo) at the beginning of this document and open it.

  4. (Optional) The SDK package is missing from the sample source code downloaded from Github. You need to download the SDK package from ZegoExpress Android first, and Copy the decompressed jar package and so to the ./video/main/libs/ (Video SDK Demo) or ./audio/app/libs/ (Audio SDK Demo) directory.

    The sample source code downloaded from the compressed package already contains the SDK package, please skip this step.

  5. The downloaded sample code lacks the appID and appSign required for SDK initialization, so you need to modify ./video/common/src/main/java/im/zego/common/ (Video SDK Demo) or ./audio/ TheGetAppIdConfig.javafile in the common/src/main/java/im/zego/common/ (Audio SDK Demo) directory. Please use the AppID and AppSign obtained in the "Prerequisites" of this article to fill in correctly (Note: You need to add L after AppID), otherwise the sample code will not run normally.

  6. Select a real Android device (recommended) or emulator that has been connected to the Internet. When the device has successfully turned on the developer mode and USB debugging function, you can see the Android Studio as shown below:

    Change to the following figure:

    Description The Android Studio software has successfully connected to the Android device, and the sample code can be run on the device.

When the development computer is connected to an Android device, most devices will pop up a prompt. Different Android manufacturers have different prompts. You can select the USB mode according to the situation.

When the Android device is connected to the development computer, you need to enable the developer mode and USB debugging function on the device according to the situation (Android devices of different manufacturers have different opening methods). The specific opening method can be searched by a search engine. For example: There is currently a Meizu Pro 5 device that has not enabled the developer mode and USB debugging function. You can search for Meizu Pro 5 Open Developer Mode in the search engine to view the specific opening tutorial.

  1. Click the build and run button on the Android Studio software to compile and run the sample code.

    If there is a problem during operation, please contact the instant technical support engineer.

2 FAQ

  1. What should I do if it reports "illegal expression" when running the downloaded sample code in Android Studio?

 Because AppID and AppSign do not have specific values ​​in the downloaded sample source code, please refer to step 5 in the "Run Sample Code" chapter of this article for processing.

  1. When running the downloaded sample source code in Android Studio, the package im.zego.zegoexpress does not exist, what should I do?

 Because it is slow to access GitHub in mainland China, the sample source code from Github download does not include the ZegoExpressEngine SDK, so It will report that the specified package does not exist, please refer to step 4 in the "Run Sample Code" chapter of this article for processing.