ZEGO no longer classifies environments into production environments and testing environments.
If you create your project in ZEGOCLOUD Admin Console on/before 2021-11-16, refer to the Testing environment deprecation to upgrade the SDK and adjust related codes.
Please ensure that the development environment meets the following technical requirements (the following instructions are based on macOS development computers as examples):
A project has been created in ZEGOCLOUD Admin Console and a valid AppID have been applied.
For the version dependency between Android Gradle plugin, Gradle, and SDK Tool, please see: Android Gradle plugin release notes
Find the Android Studio software icon on the development computer.
Open Android Studio, and click "Open an Existing Project".
In the unzipped example source code folder, select the ZegoExpressExample
folder and click "Open" to open it.
(Optional) Integrated SDK.
./main/libs/
directory.
The downloaded sample code lacks the appID, userID and token required for SDK initialization, so you need to modify the "KeyCenter.java" file in the "./KeyCenter/src/main/java/im/zego/keycenter" directory.
// Developers can get appID from admin console.
// https://console.zego.im/dashboard
// for example:
// private long _appID = 123456789L;
private long _appID = ;
// Developers should customize a user ID.
// for example:
// private String _userID = "zego_benjamin";
private String _userID = "";
// Developers can get token from admin console.
// https://console.zego.im/dashboard
// Note: The user ID used to generate the token needs to be the same as the userID filled in above!
// for example:
// private String _token = "04AAAAAxxxxxxxxxxxxxx";
private String _token = "";
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.
Click the Run
button on the Android Studio software to compile and run the sample code.
If there is a problem during operation, please contact ZEGO technical support.
We recommend you run your project on a real device. If your app runs successfully, you should hear the sound and see the video captured locally from your device.
To test out the real-time audio and video features, visit the ZEGO Express Web Demo, and enter the same AppID
, Server
and RoomID
to join the same room. If it runs successfully, you should be able to view the video from both the local side and the remote side, and hear the sound from both sides as well.
In audio-only scenarios, no video will be captured and displayed.
What should I do if it reports "illegal start of expression" when running the downloaded sample code in Android Studio?
Because AppID do not have specific values in the downloaded sample source code, please refer to step 5 in the Run the Sample Codes chapter of this article for processing.