仪表运行由于“进程崩溃"而失败.经过长时间的测试 [英] Instrumentation run failed due to 'Process crashed.' after long tests execution
问题描述
我要执行约700项测试.当我全部运行它们时,出现了崩溃
I have about 700 tests to execute. When I run them all, there raised a crash
由于进程崩溃",仪器运行失败."检查设备 有关详细信息,请参见logcat.测试运行失败:仪表运行失败 由于进程崩溃".
"Instrumentation run failed due to 'Process crashed.'" Check device logcat for details. Test running failed: Instrumentation run failed due to 'Process crashed.'
执行一段时间后,大约需要10分钟,第360-370次执行测试.
after some time of execution, about 10 minutes and ~360-370th executed test.
Logcat不包含有关此崩溃的任何信息
Logcat doesn't contain any information about this crash
它可以通过从cmd(在PC和Mac上)从Android Studio运行而适用.使用的设备-Android 4.1.1上的Samsung S3
It is applicable by running from Android Studio, from cmd (on PC and Mac). Device used - Samsung S3 on Android 4.1.1
build.gradle文件:
build.gradle file:
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 local cache should be used first
mavenLocal()
jcenter()
mavenCentral()
}
dependencies {
compile 'junit:junit:4.12'
compile fileTree(include: '*.jar', dir: 'libs')
}
AndroidManifest.xml
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xxx.yyy"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.CAMERA.autoFocus" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<application
android:allowBackup="true"
android:largeHeap="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.xxx.yyy.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="roboguice.annotations.packages"
android:value="com.xxx"/>
<meta-data
android:name="roboguice.modules"
android:value="com.xxx.yyy.MainModule"/>
</application>
</manifest>
要补充的一点:在我的代码的先前发行版中,不会发生此崩溃,但是我无法找到发生崩溃的确切变化.
One more to add: on previous released of my code this crash is not happen, but I can't find what exactly change gave a crash.
请帮助我解决这个问题,我试图在两周内弄清它.
Please help me with this issue, I'm trying to understand it over two weeks.
推荐答案
我不知道问题对您来说是否仍然存在,但我本人也遇到了此类问题. 三星设备上的某些Android版本中存在一个错误:它们没有正确关闭文件描述符,从而导致文件描述符泄漏.创建1028个描述符后,进程崩溃.
I don't know if the problem is still actual for you, but I have encountered such problem myself. There was a bug in certain Android versions on Samsung devices: they didn't close file descriptors properly thus creating file descriptors leak. After 1028 descriptors are created - the process crashes.
http://code.google.com/p/android/issues/detail?id = 32470
为避免这种情况,我不得不减少测试中HandlerThreads的使用,并在可能的情况下重新使用它们.但是更好的解决方案可能是更换设备.
To avoid this I had to cut on the usage of HandlerThreads in my tests, and re-use them where possible. But the better solution would be to change the device, probably.
这篇关于仪表运行由于“进程崩溃"而失败.经过长时间的测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!