我將所有測試轉換爲Testing Support Library。然而,當我嘗試導入LargeTest
註釋這樣無法解析符號'LargeTest'
import android.support.test.filters.LargeTest;
我得到Cannot resolve symbol 'LargeTest'
。我需要添加哪些依賴項到我的gradle文件來解決此錯誤?
我將所有測試轉換爲Testing Support Library。然而,當我嘗試導入LargeTest
註釋這樣無法解析符號'LargeTest'
import android.support.test.filters.LargeTest;
我得到Cannot resolve symbol 'LargeTest'
。我需要添加哪些依賴項到我的gradle文件來解決此錯誤?
你有沒有通過this文檔?
您需要根據您的需要添加一些這些依賴項。
dependencies {
androidTestCompile 'com.android.support.test:runner:0.4'
// Set this dependency to use JUnit 4 rules
androidTestCompile 'com.android.support.test:rules:0.4'
// Set this dependency to build and run Espresso tests
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
// Set this dependency to build and run UI Automator tests
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
}
並添加:
android {
defaultConfig {
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
}
「你有沒有閱讀過這個文檔?」是。這是我在我的問題中鏈接的確切頁面。我已經定義了所有這些依賴關係並設置了'testInstrumentationRunner'。 –
過濾註解生活以下依賴下
androidTestCompile 'com.android.support.test:runner:0.5'
如果仍然沒有工作,請提交bug。
編輯:問題是它是在0.5版中引入的,所以你必須更新你的依賴關係。
支持註釋,也許? –
@ cricket_007你的意思是'androidTestCompile'com.android.support:support-annotations:24.1.1''?我已經有這個... –