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

通过 AppiumDriverLocalSerivce 无法启动 appium service 问题

时间:2018-06-06 21:45:14      阅读:1353      评论:0      收藏:0      [点我收藏+]

标签:sed   node.js   cti   start   lag   str   date   lib   osi   

问题背景描述

通过官方提供的 AppiumDriverLocalService 方法,代码启动 appium server

 1 import io.appium.java_client.service.local.AppiumDriverLocalService;
 2 import io.appium.java_client.service.local.AppiumServiceBuilder;
 3 import io.appium.java_client.service.local.flags.GeneralServerFlag;
 4 
 5 
 6 /**
 7  * @author KingDow
 8  * @date 2018/5/18 17:31
 9  */
10 public class AppiumDriverTest {
11 
12     public static void main(String[] args) {
13 
14         AppiumServiceBuilder builder = new AppiumServiceBuilder()
15                 .withArgument(GeneralServerFlag.SESSION_OVERRIDE)
16                 .withIPAddress("127.0.0.1")
17                 .usingAnyFreePort();
18         AppiumDriverLocalService service = AppiumDriverLocalService.buildService(builder);
19         service.start();
20     }
21 }

 

得到以下的报错信息

Exception in thread "main" io.appium.java_client.service.local.AppiumServerHasNotBeenStartedLocallyException: The local appium server has not been started. The given Node.js executable: C:\Program Files\nodejs\node.exe Arguments: [C:\Users\KingDow\AppData\Roaming\npm\node_modules\appium\build\lib\main.js, --port, 8000, --address, 127.0.0.1, --session-override] 

    at io.appium.java_client.service.local.AppiumDriverLocalService.start(AppiumDriverLocalService.java:149)
    at com.ziroom.vayne.appium.server.AppiumDriverTest.main(AppiumDriverTest.java:25)
    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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: java.lang.NoSuchMethodError: com.google.common.util.concurrent.SimpleTimeLimiter.create(Ljava/util/concurrent/ExecutorService;)Lcom/google/common/util/concurrent/SimpleTimeLimiter;
    at org.openqa.selenium.net.UrlChecker.<init>(UrlChecker.java:62)
    at io.appium.java_client.service.local.AppiumDriverLocalService.ping(AppiumDriverLocalService.java:113)
    at io.appium.java_client.service.local.AppiumDriverLocalService.start(AppiumDriverLocalService.java:136)
    ... 6 more

Process finished with exit code 1

 

问题分析定位

引用的第三方依赖包版本冲突,经查找定位为 com.google.guava 版本太低导致,原版本20.0 中没有 SimpleTimeLimiter create() 方法。

 

问题解决方法

更新guava最新版本后,查看源码create() 方法存在

<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
<dependency>
    <groupId>com.google.guava</groupId>
    <artifactId>guava</artifactId>
    <version>25.1-jre</version>
</dependency>

 

通过 AppiumDriverLocalSerivce 无法启动 appium service 问题

标签:sed   node.js   cti   start   lag   str   date   lib   osi   

原文地址:https://www.cnblogs.com/KingDow/p/9146385.html

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