0

Question:

How to fix : java.lang.NoSuchMethodError: com.google.common.base.Throwables.throwIfUnchecked(Ljava/lang/Throwable;)Vmethods.

More info:

I observed this error for android as well as iOS platform.

java.lang.NoSuchMethodError: com.google.common.base.Throwables.throwIfUnchecked(Ljava/lang/Throwable;)V at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:245) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548) at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42) at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1) at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:212) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:130) at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:38) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:84) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:94)

Any one resolved this? If anyone is also facing same issue, please add your findings in comments.

Environment:

  • Mac iOS Version : 10.12 [macOS Sierra]
  • Appium : Appium1.8.1
  • Xcode : 9.3
2
  • Can you specify the version numbers that worked for you, i am also facing same error and currently using java-client 6.1.0 . and selenium-java 3.12.0
    – jayasripv
    Commented Sep 13, 2019 at 13:20
  • Moved to other project but I do remember we used older java-client than version 6.1.0 Commented Sep 20, 2019 at 12:10

2 Answers 2

1

Solution :

  1. Verify version is appropriate for "guava"
  2. If not Update version from link "guava_versions"
  3. For me it started working again when updated below version under POM.XML
    • guava
    • selenium-android-driver
    • android
    • selenium-remote-driver
0

I just started to work on Appium From scratch. I installed Appium Server Desktop version on Windows (Appium Version 1.22.0)

Then I created Simple Java code to say deploy an app on Android Phone using below code:

 public static final String APPIUM_SERVER_URL = "http://127.0.0.1:4723/wd/hub";

 DesiredCapabilities dc = new DesiredCapabilities();
 dc.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
 dc.setCapability(MobileCapabilityType.PLATFORM_VERSION, "10");
 dc.setCapability(MobileCapabilityType.APP, apk);
 dc.setCapability(MobileCapabilityType.DEVICE_NAME, "FA6C60304130");
 dc.setCapability(MobileCapabilityType.AUTOMATION_NAME, "UiAutomator2");
 dc.setCapability("autoGrantPermissions", true);

 driver = new AndroidDriver(new URL(APPIUM_SERVER_URL), dc);

I am using 7.5.1 version of Java client:

 <dependency>
            <groupId>io.appium</groupId>
            <artifactId>java-client</artifactId>
            <version>7.5.1</version>
            <scope>test</scope>
        </dependency>

Not sure, why it is throwing below exception. In the past I used similar code to run my test. Only thing which was changed was Appium Server version and java-client version for Appium. Previously I used 4.1.2 version of java client and not sure which version of server.

Does anyone know what is the problem and how to get rid of it?

java.lang.NoSuchMethodError: com.google.common.base.Throwables.throwIfUnchecked(Ljava/lang/Throwable;)V

    at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:261)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
    at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:41)
    at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
    at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
    at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:338)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
    at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:37)
    at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:89)
    at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:99)
    at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:96)
1
  • 1
    If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review
    – Lee Jensen
    Commented Jan 20, 2022 at 16:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.