How to get started

The SpeechKit Mobile SDK library for the Android platform is distributed as an aar file and available in the Maven Central repository.

  1. Step 1. Add the library to your project
  2. Step 2. Configure the library
  3. Step 3. Build and run the app

Step 1. Add the library to your project

  1. Create a new project or open an existing project, for example, in Android Studio.
  2. Install the Android SDK version 23. In Android Studio, you can do this with Android SDK Manager.
  3. Open the project's build.gradle file. Add the Maven Central repository to the list of available repositories. To do this, enter the following in the repositories section:

    repositories {
        ...
        mavenCentral()
    }
  4. Open the app's or module's build.gradle file. In the dependencies section, add a dependence:

    dependencies {
        ...
        compile 'com.yandex.android:speechkit:2.5.0'
    }
  5. The minimum version of the Android SDK that the Yandex SpeechKit library is available for is API 10, Android 2.3.3 (GINGERBREAD_MR1).

    In the defaultConfig section of your app's or module's build.gradle file, specify the minimum Android API version required by your app (10 or higher):

    defaultConfig {
            ...
            minSdkVersion 10
        }
  6. To apply changes, sync the project. In Android Studio, click Sync Now or choose File → Synchronize in the menu. Wait for syncing to finish. If syncing finished successfully, the library will be added to the project automatically during compilation.

Step 2. Configure the library

To use the library in the app, it must be configured (initialized with the specified parameters).

  1. Add an import directive to the app's activity:

    import ru.yandex.speechkit.SpeechKit;
  2. Override the onCreate() method by adding a configure() method call. This method configures the Yandex SpeechKit library. Specify the application context and your API key as arguments:

    SpeechKit.getInstance().configure(getApplicationContext(), "API key");

Step 3. Build and run the app

Build the app. You can run the app on:

Did something go wrong?

Take a look at the sample project.