Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Throwables.throwIfUnchecked(Ljava/lang/Throwable;)V


#1

i seet up appium in eclipse try to run the script got this is error please help me to solve this issue
Exception in thread “main” java.lang.NoSuchMethodError: com.google.common.base.Throwables.throwIfUnchecked(Ljava/lang/Throwable;)V
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:176)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:644)
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:249)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:131)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:144)
at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:38)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:88)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:112)
at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:73)
at runner.Demo.main(Demo.java:23)


#2

Hi,

I updated Appium server to 1.6.5-beta and appium-client to 5.0.0-BETA7
(Previously, Appium server 1.6.4 and appium-client 5.0.0-BETA2)

And, I have this same error when running my test.

Environment:

  • Maven project
  • Eclipse
  • Java1.8
  • TestNG
  • Android real devices

Anyone could help us?

Thank you in advance

Appium server logs:

[AndroidDriver] Screen already unlocked, doing nothing
[debug] [ADB] Device API level: 23
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘/Applications/android-sdk-macosx/platform-tools/adb’ with args: ["-P",5037,"-s",“04157df4a245aa2f”,“shell”,“am”,“start”,"-W","-n",“myApp/myApp.MainActivity”,"-S","-a",“android.intent.action.MAIN”,"-c",“android.intent.category.LAUNCHER”,"-f",“0x10200000”]
[Appium] New AndroidDriver session created successfully, session c1e22ffe-b7c5-4f61-87b4-ebaf6a24055a added to master session list
[debug] [BaseDriver] Event ‘newSessionStarted’ logged at 1492201670100 (13:27:50 GMT-0700 (PDT))
[debug] [MJSONWP] Responding to client with driver.createSession() result: {“platform”:“LINUX”,“webStorageEnabled”:false,“takesScreenshot”:true,“javascriptEnabled”:true,“databaseEnabled”:false,“networkConnectionEnabled”:true,“locationContextEnabled”:false,“warnings”:{},“desired”:{“app”:"",“appPackage”:"",“appActivity”:"",“newCommandTimeout”:1200,“platformVersion”:“6.0.1”,“platformName”:“Android”,“udid”:“04157df4a245aa2f”,“deviceName”:“samsung-sm_g920i-04157df4a245aa2f”,“fullReset”:true},“app”:"",“appPackage”:"",“appActivity”:",“newCommandTimeout”:1200,“platformVersion”:“6.0.1”,“platformName”:“Android”,“udid”:“04157df4a245aa2f”,“deviceName”:“04157df4a245aa2f”,“fullReset”:true,“deviceUDID”:“04157df4a245aa2f”,“deviceScreenSize”:“1440x2560”,“deviceModel”:“SM-G920I”,“deviceManufacturer”:“samsung”}
[HTTP] <-- POST /wd/hub/session 200 59317 ms - 1033
[Appium] Received SIGTERM - shutting down

Mag


#3

it is a compatability issue check versions of selenium and java client


#4

Thank Chetan.
I will update my Selenium version.

Mag


#5

Hi, I am seeing the same above issue on latest java-client version 5.0.0-BETA8 and Appium v1.6.5-beta
Any help would be much appreciated!
Thanks


#6

Hello Mague,
Did you solve this problem?


#7

Hello Heena,

Yes, it solved the issue by updating the selenium version:

  • Appium Java client: 5.0.0 BETA 7
  • Selenium Java: 3.4.0

Mague


#8

Thanks for the reply @Mague

Now I am getting different error. Any idea about this issue ?

  • Appium Java Client: 5.0.0-BETA7
  • Selenium Java: 3.4.0
  • Appium server 1.6.5-beta
  • Running test case on real devices (Nexus 6P (version 7.0.2)/ Samsung Galaxy (4.4.4))
    java.lang.NoClassDefFoundError: org/openqa/selenium/remote/Dialect
    at io.appium.java_client.remote.AppiumProtocolHandShake.createSession(AppiumProtocolHandShake.java:140)
    at io.appium.java_client.remote.AppiumProtocolHandShake.createSession(AppiumProtocolHandShake.java:76)
    at io.appium.java_client.remote.AppiumCommandExecutor.doExecute(AppiumCommandExecutor.java:111)
    at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:162)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:644)
    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:249)
    at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:131)
    at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:144)
    at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:38)
    at io.appium.java_client.AppiumDriver.(AppiumDriver.java:88)
    at io.appium.java_client.AppiumDriver.(AppiumDriver.java:123)
    at io.appium.java_client.AppiumDriver.(AppiumDriver.java:147)
    at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:153)
    at com.TestData.utility.AppiumDriverBuilder$AndroidDriverBuilder.build(AppiumDriverBuilder.java:51)
    at com.TestData.UITest.AbstractTest.connect(AbstractTest.java:24)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
    Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.remote.Dialect
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    … 42 more

java.lang.NullPointerException
at com.TestData.UITest.AbstractTest.tearDown(AbstractTest.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:33)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)


#9

getting this error after launching an app:::

			java.lang.NoSuchMethodError: com.google.common.base.Throwables.throwIfUnchecked(Ljava/lang/Throwable;)V
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:176)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
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.ios.IOSDriver.execute(IOSDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:241)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128)

#10

Balaji.
Hi! you need to remove guava file from java build path


#11

i have updated the selenium version and java client too still it giving the same error .
please guide


#12

Hi, is your issue resolved? how did you fix it? I am facing same issue


#13

Hi Balaji,
I also facing same issue, have u got any solution for this issue?


#14

Hi Shrikanth and Balaji,

I am also getting the same error once the app is opened it’s failing with the error shown below. Did you manage to resolve this issue ? Thank you

Exception in thread “main” java.lang.NoSuchMethodError: com.google.common.base.Throwables.throwIfUnchecked(Ljava/lang/Throwable;)V
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:176)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:46)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java:1)
at io.appium.java_client.HasSessionDetails.getSessionDetails(HasSessionDetails.java:36)
at io.appium.java_client.HasSessionDetails.getSessionDetail(HasSessionDetails.java:42)
at io.appium.java_client.HasSessionDetails.getPlatformName(HasSessionDetails.java:46)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:100)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:112)
at io.appium.java_client.ios.IOSDriver.(IOSDriver.java:78)
at Testcases.AppTesting.main(AppTesting.java:36)


#15

I have Selenium 3.12.0 and Java-client 6.1.10 with Appium 1.10, I do not see this error.
I do know if this helps you but just thought of telling my working config.


#16

Hi thank you for your reply. I updated my pom.xml to the one you suggested and still having the same issue on my Mac machine. Can I please know what is the version of guava you are using. I am new to Appium so Is there any other dependencies we need to make sure add if we want to run it on the iPad simulator / real devices


#17

I am using guava-23.6-jre.jar


#18

Hi after I updated my guava version to the one you mentioned 23.6-jre.jar the issue is resolved it’s now able to open the app and complete the actions that I would like to do. Thank you so much for your help.


#19

glad could help. :slight_smile:


#20

Hi I am able to run the Appium inspector on Android and IOS but unable to do it on Windows machine where my app is installed on it. Can anyone please guide me how could I achieve this. Appreciate your help. Thanks

Update: I am able to inspect the native app example calculator but not the one I need to test. I provided these details

app
platformName
deviceName

Error: An unknown server side error occurred while processing the command. Element not found (Exception from HRESULT:0x80070490)