2016-07-27 2 views
1

AndroidJunit4.class 가져 오기에 문제가 있습니다. androidTest/java/폴더에 테스트 클래스를 만들었지 만 클래스가없는 것 같습니다.계측 테스트에서 AndroidJUnit4.class를 찾을 수 없습니다.

강제로 가져 오기를해도 여전히 작동하지 않습니다. (import android.support.test. *). 여기

@RunWith(AndroidJunit4.class) 
public class RandomTest { 

} 

내 Gradle을 수 있습니다 :

defaultConfig { 
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
} 

dependencies { 
compile "com.android.support:support-annotations:23.4.0" 
compile "com.android.support:appcompat-v7:23.4.0" 
compile 'cat.ereza:customactivityoncrash:1.5.0' 
testCompile 'junit:junit:4.12' 
androidTestCompile 'junit:junit:4.12' 
androidTestCompile('com.android.support.test:runner:0.5') 
androidTestCompile('com.android.support.test:rules:0.5') 
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2') 
androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2.2') 
androidTestCompile('com.android.support.test.espresso:espresso-intents:2.2.2') 

testCompile('com.android.support.test:runner:0.5') 
testCompile('com.android.support.test:rules:0.5') 
testCompile('com.android.support.test.espresso:espresso-core:2.2.2') 
testCompile('com.android.support.test.espresso:espresso-contrib:2.2.2') 
testCompile('com.android.support.test.espresso:espresso-intents:2.2.2') 

testCompile 'org.mockito:mockito-core:1.10.19' 
testCompile "org.robolectric:robolectric:3.1.1" 
} 

이상한 것은 내가 내 프로젝트에 AndroidJunit4 파일을 찾을 수 있지만, 부모 (AndroidJunit4ClassRunner)에서, AndroidRunnerParams 클래스가 해결되지 않는 것입니다 심지어는 할 수있는 경우 내 프로젝트에서 파일을 찾으십시오. 다시

@RunWith(AndroidJunit4.class) 

ALT-ENTER에 주석을 다시 가져 오기 "프로젝트를 다시 빌드> 빌드"

을 선택

+0

또한 'testInstrumentationRunner'android.support.test.runner.AndroidJUnitRunner를 추가 하시겠습니까? "'defaultConfig 아래? – Egor

+0

예 나는 또한 그것을 추가했다, 나는 그것을 위에주의하는 것을 잊었다. – rct29

답변

0

을 주석 주석

//@RunWith(AndroidJunit4.class) 

안드로이드 스튜디오에서 -> 가져 오기 클래스