码迷,mamicode.com
首页 > 移动开发 > 详细

appium启动出现com.google.common.base.Throwables.throwI

时间:2019-08-28 17:09:47      阅读:170      评论:0      收藏:0      [点我收藏+]

标签:follow   reflect   出现   str   Suite   group   fun   jar   href   

大神链接:
https://blog.csdn.net/yunfeng482/article/details/76737683

报错日志:

Method arguments: "M6TGLMA721108530", "5190"
步骤1:启动------------>appium与应用
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)

修改配置文件:

应该是jar依赖的问题,可能发送冲突,或者引入版本不对。查看com.google.common.base.Throwables.throwIfUnchecked
经过错误位置检查发现此类和方法在guava-19.0.jar依赖中,后面经过源码查看,确实该com.google.common.base下的类Throwables无此方法,应该是appium的一个bug。
后面经过修改maven配置排除guava依赖,然后手动更新此jar包依赖到guava-22.0.jar后项目运行正常。

<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>

appium启动出现com.google.common.base.Throwables.throwI

标签:follow   reflect   出现   str   Suite   group   fun   jar   href   

原文地址:https://blog.51cto.com/357712148/2433365

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!