1

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

3 Answers 3

1

selenium-java-3.11 requires Guava 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>

You have downgraded to much older Guava version, remove your own version from the pom.xml and let selenium pick up the required version.

Sign up to request clarification or add additional context in comments.

2 Comments

thanks for the reply i have changed guava to 23.6-jre but getting an error : org.openqa.selenium.SessionNotCreatedException: A new session could not be created. Details: The desiredCapabilities object was not valid for the following reason(s): 'deviceName' can't be blank (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 488 milliseconds
@manishkumar you should open another question with more details. It seems unrelated to the original issue.
0

You might have clashing versions of Guava in your classpath (i.e signatures of the method you are trying to invoke, are different). I had previously faced NoSuchMethodError and it actually originates from clashing versions of jars. Take a look at this answer. Also take a look at this issue

1 Comment

One possibility is that you have compiled the code with one Guava jar and running the program in deployment with another version of jar which was the case when I had faced NoSuchMethodError error.
0

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

you don't need to use guava dependency if you are using maven project to add selenium-java

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.