我有一些项目有几个单元测试.当我尝试在Android Studio或终端上执行测试时出现gradle clean connectedCheck以下错误:Test running failed: Instrumentation run failed due to 'java.lang.IncompatibleClassChangeError'
它在Android 5.x设备上重现,但在4.x上没有错误发生.但是如果我尝试在Android Studio中运行单独的测试包,套件,类或某些测试,测试进展顺利.
我不明白为什么.我需要从终端执行测试
build.gradle文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 18
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.xxx.yyy"
minSdkVersion 9
targetSdkVersion 18
testApplicationId "com.xxx.zzz.tests"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
}
repositories {
mavenLocal()
jcenter() …Run Code Online (Sandbox Code Playgroud) 仅在 Windows 客户端上观察到该问题,在 OSX 上没有问题。
git pull运作良好。此外,任何存储库都会出现此问题。其他操作(例如获取、提交、推送)工作正常。
哪里有问题?如何修复它?
我有大约700个测试要执行.当我全部运行时,出现了崩溃
"由于'进程崩溃,仪表运行失败.'"检查设备logcat以获取详细信息.测试运行失败:由于"进程崩溃",仪表运行失败.
经过一段时间的执行,大约10分钟和~360-370th执行测试.
Logcat不包含有关此崩溃的任何信息
它适用于从Android Studio,cmd(在PC和Mac上)运行.使用的设备 - Android 4.1.1上的Samsung S3
build.gradle文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 18
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.xxx.yyy"
minSdkVersion 9
targetSdkVersion 18
testApplicationId "com.xxx.zzz"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
project.gradle.taskGraph.whenReady {
connectedAndroidTestDebug {
ignoreFailures = true
}
}
}
repositories {
// The …Run Code Online (Sandbox Code Playgroud) crash android automated-tests unit-testing android-instrumentation