title: How to use Google Cloud Speech v1 on Android?
body: <p>I recently updated my Android Google Cloud Speech code from v1beta1 to v1. There were a couple of changes in the API, one of them was a new method called getWordsList().</p>
  
  <p>I want to use the getWordsList() in my Android project, however the method doesn't seem to be visible to my code:</p>
  
  <pre><code>import com.google.cloud.speech.v1.SpeechGrpc;
  import com.google.cloud.speech.v1.SpeechRecognitionAlternative;
  import com.google.cloud.speech.v1.StreamingRecognizeResponse;
  import com.google.cloud.speech.v1.WordInfo;
  
  ...
  
  public void onNext(StreamingRecognizeResponse response) {
    int numOfResults = response.getResultsCount();
    if( numOfResults &gt; 0 ){
      for (int i=0;i&lt;numOfResults;i++){
        StreamingRecognitionResult result = response.getResultsList().get(i);
        SpeechRecognitionAlternative alternative = result.getAlternativesList().get(0);
        for (WordInfo wordInfo: alternative.getWordsList()) { //--&gt;&gt;Cannot resolve 'method'
          System.out.println(wordInfo.getWord());
          System.out.println(wordInfo.getStartTime().getSeconds() + " ");
        }
        ...
  </code></pre>
  
  <p>This code is from the official <a href="https://github.com/GoogleCloudPlatform/java-docs-samples/blob/master/speech/cloud-client/src/main/java/com/example/speech/Recognize.java" rel="nofollow noreferrer">repo</a>, however, I am getting the following error:</p>
  
  <blockquote>
    <p>Cannot resolve method 'getWordsList()'</p>
  </blockquote>
  
  <p>Here is my gradle:</p>
  
  <pre><code>apply plugin: 'com.android.application'
  apply plugin: 'com.google.protobuf'
  
  android {
      compileSdkVersion 25
      buildToolsVersion "25.0.0"
      defaultConfig {
          applicationId "org.test.test"
          minSdkVersion 24
          targetSdkVersion 24
          versionCode 1
          versionName "1.0"
          testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
  
          // Enabling multidex support.
          multiDexEnabled true
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
  }
  
  protobuf {
      protoc {
          artifact = 'com.google.protobuf:protoc:3.0.0'
      }
      plugins {
          grpc {
              artifact = 'io.grpc:protoc-gen-grpc-java:1.0.0'
          }
          javalite {
              artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0'
          }
      }
      generateProtoTasks {
          all().each {
              task -&gt;
                  task.builtins {
                      remove javanano
                      java {
                      }
                  }
                  task.plugins {
                      grpc {
                      }
                  }
          }
      }
  }
  
  ext {
      supportLibraryVersion = '25.0.0'
      grpcVersion = '1.4.0'
  }
  
  dependencies {
      // Generic dependencies
      compile fileTree(include: ['*.jar'], dir: 'libs')
      testCompile 'junit:junit:4.12'
      compile 'com.google.cloud:google-cloud-speech:0.23.1-alpha'
  
      // Support libraries
      compile "com.android.support:appcompat-v7:$supportLibraryVersion"
      compile "com.android.support:design:$supportLibraryVersion"
      compile "com.android.support:cardview-v7:$supportLibraryVersion"
      compile "com.android.support:recyclerview-v7:$supportLibraryVersion"
      compile 'com.android.support:multidex:1.0.1'
  
      // gRPC
      compile 'javax.annotation:javax.annotation-api:1.2'
      compile("io.grpc:grpc-protobuf:${grpcVersion}") {
          exclude module: 'jsr305'
      }
      compile("io.grpc:grpc-stub:${grpcVersion}") {
          exclude module: 'jsr305'
      }
      compile("io.grpc:grpc-auth:${grpcVersion}") {
          exclude module: 'jsr305'
      }
      compile("io.grpc:grpc-okhttp:${grpcVersion}") {
          exclude module: 'jsr305'
      }
      // OAuth2 for Google API
      compile('com.google.auth:google-auth-library-oauth2-http:0.3.0') {
          exclude module: 'jsr305'
          exclude module: 'httpclient'
      }
  
  }
  </code></pre>
  
  <p>I also noticed, I cannot use all grpc libraries, for example the following library cannot be imported:</p>
  
  <pre><code>import com.google.api.gax.rpc.StreamingCallable;
  </code></pre>
  
  <p>How can I use getWordsList() correctly in Android? Am I not using the correct build version?</p>