升级Android gradle插件版本后,我遇到了一个问题,即我的项目中没有找到测试。
这是我的build.gradle
文件:
apply plugin: 'com.android.application'
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}
}
android {
compileSdkVersion 24
buildToolsVersion '23.0.3'
defaultConfig {
applicationId 'application.sample.id'
minSdkVersion 19
targetSdkVersion 24
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
}
}
dependencies {
compile('com.android.support.test.espresso:espresso-contrib:2.2.2') {
exclude module: 'support-annotations'
}
androidTestCompile 'com.android.support:support-annotations:24.2.1'
androidTestCompile 'com.android.support.test:rules:0.5'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
}
我遇到的错误:
com.android.builder.testing.ConnectedDevice > No tests found.[emulator-name-23_x86(AVD) - 6.0] [31mFAILED [0m
No tests found. This usually means that your test classes are not in the form that your test runner expects (e.g. don't inherit from TestCase or lack @Test annotations).
:TestLauncher:connectedDebugAndroidTest FAILED