Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

issue with importing android.support.test.*

I add this dependencies to gradle:

// Unit testing dependencies

testCompile 'junit:junit:4.12'

// Set this dependency if you want to use the Hamcrest matcher library

testCompile 'org.hamcrest:hamcrest-library:1.3'

// more stuff, e.g., Mockito

androidTestCompile 'org.mockito:mockito-core:1.+'
androidTestCompile "com.google.dexmaker:dexmaker:1.2"
androidTestCompile "com.google.dexmaker:dexmaker-mockito:1.2"

androidTestCompile 'com.android.support.test:runner:0.3'
androidTestCompile 'com.android.support.test:rules:0.3'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2'

// add this for intent mocking support

androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2'

// add this for webview testing support

 androidTestCompile 'com.android.support.test.espresso:espresso-web:2.2'

and sync build.gradle successfully but when i want to import this classes :

import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;

the IDE (Android Studio 1.2) give me an error that Cannot resolve symbol test , I search too much and I didn't find any answer

like image 809
Mohammad Ranjbar Z Avatar asked Nov 09 '22 10:11

Mohammad Ranjbar Z


1 Answers

I found whats my fault , in AndroidStudio go to file/settings/compiler and uncheck the Use-in-process build then test will work

like image 191
Mohammad Ranjbar Z Avatar answered Nov 14 '22 23:11

Mohammad Ranjbar Z