Search code examples
javaappium

The import io.appium.java_client.AppiumDriver conflicts with a type defined in the same file


I'm getting below 2 compilation errors in Eclipse but I'm not understanding what may be the root cause

import io.appium.java_client.AppiumDriver; //ERROR 1
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.MobileElement;

import org.openqa.selenium.WebElement;

public class AppiumDriver {
    private AppiumDriver<MobileElement> driver = null;    //ERROR 2
}

Error 1:

The import io.appium.java_client.AppiumDriver conflicts with a type defined in the same file

Error 2:

The type AppiumDriver is not generic; it cannot be parameterized with arguments


Solution

  • You should rename your own class from

    public class AppiumDriver
    

    to

    public class CustomAppiumDriver
    

    The compiler is reporting errors based on the same name class as you are trying to import. The other way to access the classes from appium lib would be somewhat like:

    public class AppiumDriver {
        private io.appium.java_client.AppiumDriver<MobileElement> driver = null;
    }