This page contains information on how to prepare the development environment before enabling a voice call with the Agora Video SDK.

Prerequisites

Development environment:

  • A device with audio support running Android 4.1+.
  • Android SDK for API level 16+.
  • Android Studio 2.0+.
  • Before accessing Agora’s services, ensure that you have opened the ports and whitelisted the domains as specified in Firewall Requirements.

Download Agora SDK:

Agora Video SDK for Android

Downloaded files include the libs folder and the sample folder. The following table lists the contents of the libs folder.

File/Folder Name File Type
agora-rtc-sdk.jar Java JAR file
arm64-v8a folder
armeabi-v7a folder
include folder
x86 folder

Before integrating the SDK into your project, you can try to integrate the SDK into the sample first.

Create an Agora Account and Get an App ID

  1. Sign up for a developer account at https://dashboard.agora.io/.

  2. Click Add New Project on the Projects page of Dashboard.

  3. Fill in the Project Name and click Submit. You have created your first project at Agora.

  4. Find the App ID under the created project.

Add the Agora SDK to Your Project

  1. Set the storage directory of the libs folder. Open your project in Android Studio (this article takes the sample as an example), select the app/src/main/build.gradle file, and add the preset storage directory to the fileTree code line.

Ensure that the path name contains no Chinese characters. If the path contains Chinese characters, compiling the code fails and displays an error message that contains random ASCII characters.

  1. Add the libs folder according to the storage directory preset in step 1.

  2. Add sourceSets. In the build.gradle file, set the the same storage directory as the libs folder.

     android {
      ...
      sourceSets {
             main {
                 jniLibs.srcDirs = ['../../../libs']
             }
         }
     }
  3. Add the App ID in the app/src/main/res/values/strings.xml file.

    <resources>
        <string name="app_name">Agora-Android-Voice-Tutorial</string>
        ...
        <string name="agora_app_id"><#YOUR APP ID#></string>
    </resources>
  4. Click Sync Project With Gradle Files until the synchronization is complete.

Configure the Android NDK

To call the plug-ins in the inlude files in the libs folder, you need to configure the Android NDK:

  1. Click the Configure button and select Project Defaults > Project Structure. Click to download Android NDK.

  2. Click Finish when the download is complete and Android Studio will automatically add the NDK path.

    If the path is not automatically added, add it manually and check it in the local.properties file.

  3. Re-synchronize the Android project by clicking Sync Project With Gradle Files.

Add the Device Permissions

  1. Open the app/src/main/AndroidManifest.xml file and add the required device permissions to the file.

     <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="io.agora.tutorials1v1acall">
    
     <uses-permission android:name="android.permission.INTERNET" />
     <uses-permission android:name="android.permission.RECORD_AUDIO" />
     <uses-permission android:name="android.permission.CAMERA" />
     <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
     <!-- If the app uses Bluetooth, please add Bluetooth permissions.-->
     <uses-permission android:name="android.permission.BLUETOOTH" />
    
     ...
     </manifest>
  2. Re-synchronize the Android project by clicking Sync Project With Gradle Files.

Prevent Obfuscation of the Agora Classes

In the proguard-rules.pro file, add a -keep class configuration for the Agora SDK. This prevents obfuscation of the Agora SDK public class names.

-keep class io.agora.**{*;}

Next Steps

You have now finished setting up the Android environment and can start a call/live broadcast following the steps under Quickstart Guide:

  • Initialize the SDK
  • Join a Channel
  • Publish and Subscrbe to Streams