这是一个创建于 2220 天前的主题,其中的信息可能已经有所发展或是发生改变。
我有段代码是
```
System.setProperty("webdriver.gecko.driver", new File(new File(this.getClass().getResource("/").getPath()).getParent()).getParent() + "\\tools\\geckodriver.exe");//设置 geckodriver 所在路径
System.out.println(System.getProperty("webdriver.gecko.drive"));
FirefoxProfile profile = new FirefoxProfile();
```
然后跑到第三句会报 [ Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;)V ] 这个错误,请问有人遇到过吗
7 条回复 2019-10-12 14:55:38 +08:00  | | 1 xionghongzhi 2019-10-12 14:34:23 +08:00 建议 google. 检查一下你的 jar 包是不是有冲突. |
 | | 2 xuanbg 2019-10-12 14:35:27 +08:00 应该是包的版本不对,没有 checkArgument 这个方法。 |
 | | 3 Raymon111111 2019-10-12 14:39:01 +08:00 NoSuchMethodError 一般都是包冲突, 你全局搜一下 com.google.common.base.Preconditions 看看是不是有两个. |
 | | 4 wsz66 2019-10-12 14:40:35 +08:00 |
 | | 5 wsz66 2019-10-12 14:41:28 +08:00 @ xuanbg 有可能,因为代码是别人给我的,他给的时候不是最新的,我换个版本试试 |
 | | 6 jie170601 2019-10-12 14:50:21 +08:00 上次遇到这个报错是 maven 下包下残了,删了重下解决,也不知道为什么我这网 maven 经常下个 170 字节的 jar 包 |
 | | 7 wsz66 2019-10-12 14:55:38 +0:00 |