1

我收到 Appium 安装程序无法启动应用程序的错误。我正在使用下面的配置设置:

java-client = 3.1.0
selenium-java = 3.11.0
appium-version = 1.7.0

还添加了以下依赖项,但仍然面临同样的问题:

<dependency>
    <groupId>com.google.code.gson</groupId>
    <artifactId>gson</artifactId>
    <version>2.8.5</version>
</dependency> 

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

我设置的以下功能:

File app = new File(prop.getProperty("apkFilePath"));
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability("DeviceName", "Redmi Note 5");
cap.setCapability("PlatformVersion", prop.getProperty("platformVersion"));
cap.setCapability("platformName", "Android");
cap.setCapability("app", app.getAbsolutePath());
try{
    driver=new AndroidDriver(new URL("http://0.0.0.0:4723/wd/hub"),cap);
}catch(Exception e){
    e.printStackTrace();
}


Error: java.lang.NoSuchMethodError: 
    com.google.common.collect.ImmutableSortedSet.toImmutableSortedSet(Ljava/util/Comparator;)Ljava/util/stream/Collector;
    at org.openqa.selenium.remote.NewSessionPayload.lambda$validate$4(NewSessionPayload.java:199)
    at java.util.stream.ReferencePipeline$11$1.accept(ReferencePipeline.java:372)
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
    at java.util.stream.ReferencePipeline$11$1.accept(ReferencePipeline.java:373)
    at java.util.Iterator.forEachRemaining(Iterator.java:116)
    at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
    at org.openqa.selenium.remote.NewSessionPayload.validate(NewSessionPayload.java:215)
    at org.openqa.selenium.remote.NewSessionPayload.(NewSessionPayload.java:163)
    at org.openqa.selenium.remote.NewSessionPayload.create(NewSessionPayload.java:114)

请看一下如何解决这个问题..我最近两天正在尝试,但仍然面临同样的问题。还有其他方法可以解决此appium设置,请建议...等待善意的回应...

4

3 回答 3

0

尝试使用platformVersion而不是PlatformVersiondeviceName而不是DeviceName

cap.setCapability("deviceName", "Redmi Note 5");
cap.setCapability("platformVersion", prop.getProperty("platformVersion"));
//or you can use
//cap.setCapability("platformVersion", "8.1.0"); //your android os version directly

如果您使用 maven 项目添加 selenium-java,则不需要使用 guava 依赖项

于 2018-09-17T10:45:01.063 回答
0

selenium-java-3.11需要番石榴23.6-jre as per the pom.xml

<dependency>
  <groupId>com.google.guava</groupId>
  <artifactId>guava</artifactId>
  <version>23.6-jre</version>
  <classifier></classifier>
</dependency>

您已降级到更旧的 Guava 版本,从 pom.xml 中删除您自己的版本并让 selenium 选择所需的版本。

于 2018-09-17T08:32:51.467 回答
0

您的类路径中可能有冲突的版本Guava(即您尝试调用的方法的签名不同)。我以前遇到过NoSuchMethodError,它实际上源于罐子的冲突版本。看看这个答案。也看看这个问题

于 2018-09-17T08:30:06.363 回答