java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;) with Selenium, gradle and ChromeDriver

前端 未结 7 1752
别跟我提以往
别跟我提以往 2020-11-27 08:28

I am trying to use Selenium api with Gradle. This is my build.gradle dependency section:

dependencies {
    compile \'com.google.api-client:google-api-clien         


        
7条回答
  •  南笙
    南笙 (楼主)
    2020-11-27 08:58

    I have the exact same problem (I am using Maven though).

    I noticed that the problem is that using one of com.google.api-client, or com.google.oauth-client, or com.google.apis:google-api-services-sheets alongside org.seleniumhq.selenium causes the error.

    The problem is that both dependencies depend on a different com.google.guava:guava artifact.

    In order to solve the error, you should explicitly depend on a single com.google.guava:guava artifact. So go ahead and add the following in your build.gradle:

    compile 'com.google.guava:guava:27.0.1-jre'

提交回复
热议问题