NoSuchMethodError

hi,
i got java.lang.NoSuchMethodError after setting up my first appium project
the code is simple, it fails at this line:
driver = new AppiumDriver(new URL(“http://127.0.0.1:4723/wd/hub”), capabilities);

The trace is:
java.lang.NoSuchMethodError: com.google.common.base.Joiner$MapJoiner.appendTo(Ljava/lang/StringBuilder;Ljava/lang/Iterable;)Ljava/lang/StringBuilder;
at com.google.common.net.MediaType.toString(MediaType.java:674)
at org.openqa.selenium.remote.http.JsonHttpCommandCodec.encode(JsonHttpCommandCodec.java:197)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:152)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:572)

my pom.xml is:

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>LATEST</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>io.appium</groupId>
        <artifactId>java-client</artifactId>
        <version>1.2.1</version>
    </dependency>
    <dependency>
        <groupId>com.googlecode.json-simple</groupId>
        <artifactId>json-simple</artifactId>
        <version>1.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>2.6</version>
        <scope>test</scope>
    </dependency>
    <!-- Includes the Sauce JUnit helper libraries 
    <dependency>
        <groupId>com.saucelabs</groupId>
        <artifactId>sauce_junit</artifactId>
        <version>1.0.18</version>
        <scope>test</scope>
    </dependency>-->
    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.2.4</version>
    </dependency>
</dependencies>

i’ve google it, and some say that i use an older guava.jar, but i decomplie guava-15.0.jar and find the Joiner.appendTo(StringBuilder, Iterable) exist, why it always showing this error?

Java dependencies are so finicky! I would try to get the latest version of everything and double check to make sure the actual dependencies you want are included. Sometimes the pom file doesn’t accurately represent the jar libs being used.

@Chris

Like @jonahss said use the latest versions of selenium and java-client.

Just a note, if you are using the latest java-client , make sure to use AndroidDriver() instead of AppiumDriver().

Cheers

i’ve use 2.0.0 java-client and the lastest selenium, close other project, only keep this project open, and run the test, but still get this error…maybe some depency use an older version of guava, but i can’t check it one by one as there’re about 20 jar file need to check. how am i supposed to solve it?

java dependency management is a constant thorn in my side, and I don’t fully understand it, sorry :frowning: