appium boot appears at com.google.common.base.Throwables.throwI

Posted by boushley on Wed, 02 Oct 2019 05:59:45 +0200

Great God Link:
https://blog.csdn.net/yunfeng482/article/details/76737683

Error log:

Method arguments: "M6TGLMA721108530", "5190"
//Step 1: Start - ----------> appium and its application
java.lang.NoSuchMethodError: com.google.common.base.Throwables.throwIfUnchecked(Ljava/lang/Throwable;)V
io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:253)
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:212)
org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:130)
io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:38)
io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:84)
io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:94)
io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:95)
base.DriverBase.initDriver(DriverBase.java:134)
autotest.runbase.BestRuner.BeforeClass(BestRuner.java:47)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:59)
org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:451)
org.testng.internal.Invoker.invokeConfigurations(Invoker.java:222)
org.testng.internal.Invoker.invokeConfigurations(Invoker.java:142)
org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:163)
org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:105)
org.testng.TestRunner.privateRun(TestRunner.java:648)
org.testng.TestRunner.run(TestRunner.java:505)
org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)
org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)
org.testng.SuiteRunner.run(SuiteRunner.java:364)
org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)
org.testng.TestNG.runSuitesSequentially(TestNG.java:1187)
org.testng.TestNG.runSuitesLocally(TestNG.java:1116)
org.testng.TestNG.runSuites(TestNG.java:1028)
org.testng.TestNG.run(TestNG.java:996)
autotest.runbase.ExecMain.appiumIniterMain(ExecMain.java:29)
autotest.runbase.ExecMain.main(ExecMain.java:34)

Modify the configuration file:

It should be a jar dependency issue, either sending conflicts or incorrectly introducing versions. Check out com.google.common.base.Throwables.throwIfUnchecked
After error location checking, it is found that this kind of method and method are in guava-19.0.jar dependency. After source code checking, it is true that the Throwables class under com.google.common.base does not have this method. It should be a bug in appium.
After modifying the maven configuration to exclude the guava dependency, the jar package dependency is manually updated to guava-22.0.jar and the project runs normally.

<dependency>
            <groupId>io.appium</groupId>
            <artifactId>java-client</artifactId>
            <!-- <version>5.0.0-BETA9</version> -->
            <version>4.1.2</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-core</artifactId>
                </exclusion>
                <!-- <exclusion>
                    <groupId>org.seleniumhq.selenium</groupId>
                    <artifactId>selenium-remote-driver</artifactId>
                </exclusion> -->
                <exclusion>
                    <groupId>com.google.guava</groupId>
                    <artifactId>guava</artifactId>
                </exclusion>
            </exclusions>

        </dependency>

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>22.0</version>
        </dependency>

Topics: Java Google Selenium Android