Appium在IDEA上运行时遇到的那些坑

在研究Appium时需要代码来执行程序并启动手机或模拟器上的相应的软件来达到自启动模式。

issue 1:

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

app启动成功以后,报异常,提示下面一行代码有问题

AndroidDriver driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);

解决方案:因为我用的IDEA软件,所以配置maven来解决

<dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>23.0</version>
            <!-- or, for Android: -->
            <!--<version>23.0-android</version>-->
        </dependency>

如果你使用的是Android Studio,则可以在gradle中添加依赖

compile ‘com.google.guava:guava:23.0

注意上面的版本号是我自己从guava的github上复制的,最新版本点击这里

issue 2:

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/base/Function

未完待续……,很多类似异常 ,复制异常百度查询

猜你喜欢

转载自blog.csdn.net/dota_wy/article/details/80608391
今日推荐