Max Pinto
Max Pinto

Reputation: 1483

Gradle Espresso package not recognized

i can not import the espresso package

this is my app gradle file

apply plugin: 'com.android.application'

android {
signingConfigs {
    config {
        keyAlias 'XXXXX'
        keyPassword 'XXXXX'
        storeFile file('XXXX')
        storePassword 'XXXX'
    }
}
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
    applicationId 'my.package.name'
    minSdkVersion 15
    targetSdkVersion 19
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.config
    }
}
productFlavors {
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}
}


dependencies {
compile 'com.android.support:multidex:1.0.0'
compile project(':customlib1')
compile project(':customlib2')

compile 'com.android.support:support-annotations:22.2.0'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2'
androidTestCompile 'com.android.support.test:runner:0.3'
androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2'

}

i just clean and rebuild my project and update libraries, but when i try to use in my Test

import android.test.ActivityInstrumentationTestCase2;
import android.test.suitebuilder.annotation.LargeTest;

import com.estratek.postreet.postreet_lib.activities.About;

import static java.util.regex.Pattern.matches;

@LargeTest
public class EspressoTest extends  ActivityInstrumentationTestCase2<About> {

public EspressoTest() {
    super(About.class);
}

@Override
public void setUp() throws Exception {
    super.setUp();
    getActivity();
}

public void testListGoesOverTheFold() {
    onView(withText("Hello world!")).check(matches(isDisplayed()));
}

}

this line give me error, and i can't import the not found functions:

onView(withText("Hello world!")).check(matches(isDisplayed()));

Am i missing something?

Upvotes: 0

Views: 212

Answers (2)

Be_Negative
Be_Negative

Reputation: 4972

Manually invoking the gradle task sometimes helps as well. Try running ./gradlew assembleAndroidTest from the terminal.

Upvotes: 1

mariopce
mariopce

Reputation: 1136

Check if you added correct maven repositories in repositories section. Such mavenCentral() mavenLocal()

Upvotes: 0

Related Questions