Search code examples
javagradleintellij-14

Why can I not import Appium if it's in my Gradle dependencies?


I am using Intellij Community Edition with Gradle for the build.

here is my build.gradle deps:

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.+'
    testCompile 'info.cukes:cucumber-java:1.2.4', 'info.cukes:cucumber-junit:1.2.4'
    classpath 'com.android.tools.build:gradle:1.3.0'
    classpath 'com.amazonaws:aws-devicefarm-gradle-plugin:1.2'
    compile 'io.appium:java-client:4.0.0'
    classpath "io.qameta.allure:allure-gradle:<latest>"
}

When I try to do import any of the appium stuff from io. Intellij says it isn't there. Even stranger in wy External Libraries there are numerous Gradle: libraries, but no Library for Appium.

I suppose Appium isn't a library, but I have tried both complie and testCompile and with neither one can I import any appium namespaces.

import io.appium.java_client.functions.AppiumFunction;
import org.openqa.selenium.support.ui.ExpectedCondition;

these come up as not found in both my src and test folders. On the other hand I can import cucumber no problem.

import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;

the 2 above work and intellij will compile with them.


Solution

  • I'm using this dependency in my test and it works fine. Could you please try the below. Make sure you rebuild the project after changing the dependency

    dependencies{
      // https://mvnrepository.com/artifact/io.appium/java-client
      compile group: 'io.appium', name: 'java-client', version: '5.0.4'
    }