Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot resolve method getIdlingResource() - Android Espresso

I'm trying to use IdlingResources to test something after a network call is done. I have a CountingIdlingResource keeping track of running jobs in my Main Activity, but my Test file doesn't recognize getIdlingResource:

enter image description here

Here are my import statements:

package com.example.android.bakingapp;

import android.support.test.espresso.Espresso;
import android.support.test.espresso.contrib.RecyclerViewActions;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;

import com.example.android.bakingapp.activities.MainActivity;
import com.example.android.bakingapp.activities.RecipeActivity;

import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.intent.Intents.intended;
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasComponent;
import static android.support.test.espresso.matcher.ViewMatchers.withId;

I also have this included in my gradle dependencies:

androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
compile 'com.android.support.test.espresso:espresso-idling-resource:2.2.2'
like image 701
Adam Zarn Avatar asked Aug 28 '17 21:08

Adam Zarn


1 Answers

Did you add this dependency to gradle?

androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'

compile 'com.android.support.test.espresso:espresso-idling-resource:2.2.2'

like image 184
Leontsev Anton Avatar answered Sep 30 '22 06:09

Leontsev Anton