Java client master does not build


#1

Hi,

Hasn’t been using Appium for a while so I fresh cloned the java client, and then got a lot of error as shown below when just build or run a test.

Could not figure out why as I did not change anything. Is there any additional setup I need to do?

==========================================================
Information:java: Errors occurred while compiling module ‘java-client_main’
Information:javac 1.8.0_45 was used to compile java sources
Information:12/13/17, 12:10 AM - Compilation completed with 20 errors and 0 warnings in 2s 764ms
/Users/jfang1/Proj/java-client/src/main/java/io/appium/java_client/MobileElement.java
Error:(45, 42) java: findElements(org.openqa.selenium.By) in io.appium.java_client.MobileElement cannot override findElements(org.openqa.selenium.By) in org.openqa.selenium.remote.RemoteWebElement
return type java.util.List<io.appium.java_client.MobileElement> is not compatible with java.util.List<org.openqa.selenium.WebElement>
Error:(49, 42) java: findElements(java.lang.String,java.lang.String) in io.appium.java_client.MobileElement cannot override findElements(java.lang.String,java.lang.String) in org.openqa.selenium.remote.RemoteWebElement
return type java.util.List<io.appium.java_client.MobileElement> is not compatible with java.util.List<org.openqa.selenium.WebElement>
Error:(53, 42) java: findElementsById(java.lang.String) in io.appium.java_client.MobileElement cannot override findElementsById(java.lang.String) in org.openqa.selenium.remote.RemoteWebElement
return type java.util.List<io.appium.java_client.MobileElement> is not compatible with java.util.List<org.openqa.selenium.WebElement>
Error:(57, 32) java: findElementsByLinkText(java.lang.String) in io.appium.java_client.MobileElement cannot override findElementsByLinkText(java.lang.String) in org.openqa.selenium.remote.RemoteWebElement
return type java.util.List<io.appium.java_client.MobileElement> is not compatible with java.util.List<org.openqa.selenium.WebElement>
Error:(61, 32) java: findElementsByPartialLinkText(java.lang.String) in io.appium.java_client.MobileElement cannot override findElementsByPartialLinkText(java.lang.String) in org.openqa.selenium.remote.RemoteWebElement
return type java.util.List<io.appium.java_client.MobileElement> is not compatible with java.util.List<org.openqa.selenium.WebElement>
Error:(65, 32) java: findElementsByTagName(java.lang.String) in io.appium.java_client.MobileElement cannot override findElementsByTagName(java.lang.String) in org.openqa.selenium.remote.RemoteWebElement
return type java.util.List<io.appium.java_client.MobileElement> is not compatible with java.util.List<org.openqa.selenium.WebElement>
Error:(69, 32) java: findElementsByName(java.lang.String) in io.appium.java_client.MobileElement cannot override findElementsByName(java.lang.String) in org.openqa.selenium.remote.RemoteWebElement
return type java.util.List<io.appium.java_client.MobileElement> is not compatible with java.util.List<org.openqa.selenium.WebElement>
Error:(73, 32) java: findElementsByClassName(java.lang.String) in io.appium.java_client.MobileElement cannot override findElementsByClassName(java.lang.String) in org.openqa.selenium.remote.RemoteWebElement
return type java.util.List<io.appium.java_client.MobileElement> is not compatible with java.util.List<org.openqa.selenium.WebElement>
Error:(77, 32) java: findElementsByCssSelector(java.lang.String) in io.appium.java_client.MobileElement cannot override findElementsByCssSelector(java.lang.String) in org.openqa.selenium.remote.RemoteWebElement
return type java.util.List<io.appium.java_client.MobileElement> is not compatible with java.util.List<org.openqa.selenium.WebElement>
Error:(81, 32) java: findElementsByXPath(java.lang.String) in io.appium.java_client.MobileElement cannot override findElementsByXPath(java.lang.String) in org.openqa.selenium.remote.RemoteWebElement
return type java.util.List<io.appium.java_client.MobileElement> is not compatible with java.util.List<org.openqa.selenium.WebElement>
/Users/jfang1/Proj/java-client/src/main/java/io/appium/java_client/AppiumDriver.java
Error:(144, 30) java: findElements(org.openqa.selenium.By) in io.appium.java_client.AppiumDriver cannot override findElements(org.openqa.selenium.By) in org.openqa.selenium.remote.RemoteWebDriver
return type java.util.List is not compatible with java.util.List<org.openqa.selenium.WebElement>
Error:(148, 30) java: findElements(java.lang.String,java.lang.String) in io.appium.java_client.AppiumDriver cannot override findElements(java.lang.String,java.lang.String) in org.openqa.selenium.remote.RemoteWebDriver
return type java.util.List is not compatible with java.util.List<org.openqa.selenium.WebElement>
Error:(152, 30) java: findElementsById(java.lang.String) in io.appium.java_client.AppiumDriver cannot override findElementsById(java.lang.String) in org.openqa.selenium.remote.RemoteWebDriver
return type java.util.List is not compatible with java.util.List<org.openqa.selenium.WebElement>
Error:(156, 20) java: findElementsByLinkText(java.lang.String) in io.appium.java_client.AppiumDriver cannot override findElementsByLinkText(java.lang.String) in org.openqa.selenium.remote.RemoteWebDriver
return type java.util.List is not compatible with java.util.List<org.openqa.selenium.WebElement>
Error:(160, 20) java: findElementsByPartialLinkText(java.lang.String) in io.appium.java_client.AppiumDriver cannot override findElementsByPartialLinkText(java.lang.String) in org.openqa.selenium.remote.RemoteWebDriver
return type java.util.List is not compatible with java.util.List<org.openqa.selenium.WebElement>
Error:(164, 20) java: findElementsByTagName(java.lang.String) in io.appium.java_client.AppiumDriver cannot override findElementsByTagName(java.lang.String) in org.openqa.selenium.remote.RemoteWebDriver
return type java.util.List is not compatible with java.util.List<org.openqa.selenium.WebElement>
Error:(168, 20) java: findElementsByName(java.lang.String) in io.appium.java_client.AppiumDriver cannot override findElementsByName(java.lang.String) in org.openqa.selenium.remote.RemoteWebDriver
return type java.util.List is not compatible with java.util.List<org.openqa.selenium.WebElement>
Error:(172, 20) java: findElementsByClassName(java.lang.String) in io.appium.java_client.AppiumDriver cannot override findElementsByClassName(java.lang.String) in org.openqa.selenium.remote.RemoteWebDriver
return type java.util.List is not compatible with java.util.List<org.openqa.selenium.WebElement>
Error:(176, 20) java: findElementsByCssSelector(java.lang.String) in io.appium.java_client.AppiumDriver cannot override findElementsByCssSelector(java.lang.String) in org.openqa.selenium.remote.RemoteWebDriver
return type java.util.List is not compatible with java.util.List<org.openqa.selenium.WebElement>
Error:(180, 20) java: findElementsByXPath(java.lang.String) in io.appium.java_client.AppiumDriver cannot override findElementsByXPath(java.lang.String) in org.openqa.selenium.remote.RemoteWebDriver
return type java.util.List is not compatible with java.util.List<org.openqa.selenium.WebElement>
/Users/jfang1/Proj/java-client/src/main/java/io/appium/java_client/touch/offset/AbstractOptionCombinedWithPosition.java
Information:java: Some input files use unchecked or unsafe operations.
Information:java: Recompile with -Xlint:unchecked for details.


#2

@SergeyTichomirov can you take a look? Since my company (a current saucelab client) is evaluating the TestObject test service, I was asked to participate. I chose java client to run since I have not used Appium for a while.


#3

for now I just created a new gradle project with minimum dependencies and copied the test code to the test source of this new project. Enough for my purpose (to try TestObject).

Not sure why the master won’t compile for me …


#4

what you are getting here is a class cast exception, use either WebElement or MobileElement. That will solve the issue.

/Users/jfang1/Proj/java-client/src/main/java/io/appium/java_client/MobileElement.java
Error:(45, 42) java: findElements(org.openqa.selenium.By) in io.appium.java_client.MobileElement cannot override findElements(org.openqa.selenium.By) in org.openqa.selenium.remote.RemoteWebElement
return type java.util.List<io.appium.java_client.MobileElement> is not compatible with java.util.List<org.openqa.selenium.WebElement>


#5

@Venkatesh I did not change any code. This is the code from master branch :slight_smile:
I am guessing some of my setting or gradle or dependency has wrong version. But I cleaned project and gradle cache, re clone etc. still same.


#6

Hi @fangmobile… I’m having this same issue. Were you able to resolve it?

Thanks