Android 测试项目崩溃并出现错误“测试运行失败:由于‘进程崩溃’,仪器运行失败。”

2024-03-22

My problem seems little different than here Test run failed: Instrumentation run failed due to 'Process crashed.' when testing multiple Android activity https://stackoverflow.com/questions/9891382/test-run-failed-instrumentation-run-failed-due-to-process-crashed-when-testi
I have followed steps given in the pdf https://robotium.googlecode.com/files/TestAndroidCalculatorAPK-BlackBoxTesting-V1_0.pdf. I have created test project "TestAndroidCalculatorBlackbox" (do we need to have two project one test and one main project, perhaps this could be the reason, cause in Robotium "Getting Started" link they want us to create projects for Notepad),
and added jars robotium-solo-5.0.1.jar,robotium-solo-1.6.0.jar, to get rid of red error lines below solo. functions and jay.way package.
I am attaching the error screenshot: Project tree and error screen shot y AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.testcalculator"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="8" />

    <instrumentation
        android:name="android.test.InstrumentationTestRunner"
        android:targetPackage="com.testcalculator" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" android:debuggable="true">
        <uses-library android:name="android.test.runner" />
    </application>

</manifest>

我已在仪器列表中添加了包:

 c:\> adb shell pm list instrumentation
instrumentation:PACKAGE.test.test/android.test.InstrumentationTestRunner (target=PACKAGE)
instrumentation:PACKAGE.test.test.test.test.test.test/android.test.InstrumentationTestRunner (target=PACKAGE.test.test)
instrumentation:com.example.android.apis/.app.LocalSampleInstrumentation (target=com.example.android.apis)
>> instrumentation:com.testcalculator/android.test.InstrumentationTestRunner (target=com.testcalculator) <<

对于那些迁移到或当前使用Androidx,此错误是由于使用testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"代替testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner".

使用后者可以完全解决该错误。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Android 测试项目崩溃并出现错误“测试运行失败:由于‘进程崩溃’,仪器运行失败。” 的相关文章

随机推荐