java.lang.NoSuchMethodError:com.google.common.collect.ImmutableSortedSet.toImmutableSortedSet(Ljava/util/Comparator;)Ljava/util/stream/Collector; [英] java.lang.NoSuchMethodError: com.google.common.collect.ImmutableSortedSet.toImmutableSortedSet(Ljava/util/Comparator;)Ljava/util/stream/Collector;
问题描述
Appium安装程序无法启动应用程序时出现错误.我在下面使用配置设置:
I am getting an error with Appium setup unable to launch app. I am using configuration setup below:
java-client = 3.1.0
selenium-java = 3.11.0
appium-version = 1.7.0
还添加了以下依赖性,但仍然面临相同的问题:
Also added following dependency but still facing same problem:
<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设置,建议...等待亲切的回应...
Please take a look into this how to resolve this problem.. i am trying last two days but still facing same problem. there is any other ways to resolve this appium setup kindly suggest... Waiting for kind response...
推荐答案
尝试使用 platformVersion 代替 PlatformVersion 和 deviceName 代替 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
you don't need to use guava dependency if you are using maven project to add selenium-java
这篇关于java.lang.NoSuchMethodError:com.google.common.collect.ImmutableSortedSet.toImmutableSortedSet(Ljava/util/Comparator;)Ljava/util/stream/Collector;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!