Search code examples
javaapiibm-cloudspeech-to-textibm-watson

Watson STT Java - MediaType AUDIO_WEBM can not be resolved


The MediaType AUDIO_WEBM can not be resolved. Am I missing something? I receive the error below.

[ERROR] /C:/Users/IBM_ADMIN/workspace/ListenApp/src/main/java/com/ibm/watson/developer_cloud/speech_to_text/v1/util/MediaTypeUtils.java:[39,43] cannot find symbol

[ERROR] symbol:   variable AUDIO_WEBM

My dependencies are;

<dependency>
    <groupId>com.ibm.watson.developer_cloud</groupId>
    <artifactId>speech-to-text</artifactId>
    <version>3.7.2</version>
</dependency>

<dependency>
    <groupId>com.ibm.watson.developer_cloud</groupId>
    <artifactId>java-sdk</artifactId>
    <version>3.0.0-RC1</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -->
<dependency>
    <groupId>com.squareup.okhttp3</groupId>
    <artifactId>okhttp</artifactId>
    <version>3.6.0</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp-ws -->
<dependency>
    <groupId>com.squareup.okhttp3</groupId>
    <artifactId>okhttp-ws</artifactId>
    <version>3.4.2</version>
</dependency>

Solution

  • Your dependencies are wrong. You are trying to use 3.0.0-RC1 and 3.7.2 at the same time. You also don't need to include okhttp it comes with the SDK already.

    <dependency> 
        <groupId>com.ibm.watson.developer_cloud</groupId>
        <artifactId>speech-to-text</artifactId>
        <version>3.8.0</version>
    </dependency>
    

    If you want to use other services you could include them one by one or you could include all the services using:

    <dependency> 
        <groupId>com.ibm.watson.developer_cloud</groupId>
        <artifactId>java-sdk</artifactId>
        <version>3.8.0</version>
    </dependency>