0
我遇到安卓意式濃縮咖啡測試問題。我似乎無法訪問「AndroidJUnit4.class」。下面的代碼給我「@RunWith(AndroidJUnit4.class)」爲「無法解析符號AndroidJUnit4」。意式濃縮咖啡測試 - Android
import android.test.suitebuilder.annotation.LargeTest;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@LargeTest
public class HelloWorldEspressoTest {
@Rule
public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule(MainActivity.class);
@Test
public void listGoesOverTheFold() {
onView(withText("Hello world!")).check(matches(isDisplayed()));
}
}
我知道這是關係到的build.gradle文件中的設置,但我不知道什麼是錯。以下是我正在使用的內容的副本。
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "example.com.myapp"
minSdkVersion 22
targetSdkVersion 22
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.android.support:appcompat-v7:23.0.1'
testCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
androidTestCompile 'com.android.support.test:runner:0.4.1'
androidTestCompile 'com.android.support.test:rules:0.4'
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
compile project(':volleylibrarygitpull')
}
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:22.2.0'
}
我會很感激,如果有人能告訴我什麼是錯的,以便我的build.gradle文件我用咖啡測試框架。我需要支持材料設計所以後來23.0.1有cardview,recyclerview會做一個較低的API等級。
任何人有任何想法,爲什麼谷歌稱他們的樣品測試「listGoesOverTheFold」? – nAndroid