由于“进程崩溃",检测运行失败.经过长时间

时间:2023-05-02
本文介绍了由于“进程崩溃",检测运行失败.经过长时间的测试执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我有大约 700 个测试要执行.当我全部运行它们时,引发了崩溃

I have about 700 tests to execute. When I run them all, there raised a crash

由于进程崩溃",仪器运行失败."检查设备详细信息.测试运行失败:检测运行失败由于进程崩溃".

"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

它适用于从 Android Studio 运行,从 cmd(在 PC 和 Mac 上).使用的设备 - Android 4.1.1 上的三星 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/问题/详细信息?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.

这篇关于由于“进程崩溃",检测运行失败.经过长时间的测试执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

上一篇:即使在应用退出后,如何使用 UIAutomation 工具继续 下一篇:以编程方式安装 Android apk 作为测试框架的一部分

相关文章

最新文章