java.lang.NoSuchMethodError: com.google.common.io.ByteStreams.exhaust(Ljava/io/InputStream;)J

With some IDE there’s a plugin to debug this kind of case.
enter image description here

Anyway google-api-client 1.22.0, as you can see, depends on guava-jdk5 17. That version is in conflict with google-out-library.oath2-http that need version of guava > 20

Try to modify your pom.xml like this

    <dependency>
        <groupId>com.google.api-client</groupId>
        <artifactId>google-api-client</artifactId>
        <version>1.22.0</version>
        <exclusions>
            <exclusion>
                <groupId>com.google.guava</groupId>
                <artifactId>guava-jdk5</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

That produce this:

enter image description here

With this, you’re excluding the old version and use version 23.0, instead of 17.0. I hope it helps.

Leave a Comment