本文介绍了java.lang.NoSuchMethodError: com.google.common.collect.ImmutableSortedSet.toImmutableSortedSet(Ljava/util/Comparator;)Ljava/util/stream/Collector;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

java-client = 3.1.0硒-java = 3.11.0appium 版本 = 1.7.0

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

<groupId>com.google.code.gson</groupId><artifactId>gson</artifactId><version>2.8.5</version></依赖><依赖><groupId>com.google.guava</groupId><artifactId>番石榴</artifactId><version>18.0</version></依赖>

我设置的以下功能:

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());尝试{driver=new AndroidDriver(new URL("http://0.0.0.0:4723/wd/hub"),cap);}catch(异常e){e.printStackTrace();}


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

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

解决方案

尝试使用 platformVersion 代替 PlatformVersiondeviceName 代替 >设备名称.

cap.setCapability("deviceName", "Redmi Note 5");cap.setCapability("platformVersion", prop.getProperty("platformVersion"));//或者你可以使用//cap.setCapability("platformVersion", "8.1.0");//你的android os版本直接

如果你使用的是 maven 项目,你不需要使用 guava 依赖添加硒-java

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>

Following capability that I have set:

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)

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...

解决方案

try using platformVersion instead of PlatformVersion and deviceName instead of 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

这篇关于java.lang.NoSuchMethodError: com.google.common.collect.ImmutableSortedSet.toImmutableSortedSet(Ljava/util/Comparator;)Ljava/util/stream/Collector;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-28 06:01