I am adding Espresso to my project in Android Studio. I have installed the Support Repository and in fact have already been using pieces of it. Then I added these dependencies to app/build.gradle
per the install instructions:
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.0'
androidTestCompile 'com.android.support.test:testing-support-lib:0.1'
in writing my test, auto complete recognizes the existence of the artifacts. But when I run I get this error:
error: package android.support.test does not exist
error: package org.junit does not exist
and a number of other subpackages to these two.
So I removed the two above lines from build.gradle and attempted to add then in the GUI project structure/modules/dependencies
neither 'com.android.support.test.espresso:espresso-core:2.0' nor 'com.android.support.test:testing-support-lib:0.1' appear as options to choose from. However, in my file system there is <sdk>extrasandroidm2repositorycomandroidsupportestespressoespresso-core2.0
with the full complement of files including espresso-core-2.0.aar
which I am able to open and navigate within it via winzip. In the file system it looks no different than the other libraries installed via SDK Manager with Support Repository.
Why doesn't android studio recognize this library?
Your help is greatly appreciated, no one else that I can find seems to have run into this problem. This is the closest I could find: Why do packages from library module does not exist upon compilation, even when Android Studio shows no errors in code?
I have tried reinstalling Support Repository twice.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…