Android 测试项目崩溃,错误 "Test run failed: Instrumentation run failed due to ' 进程崩溃 .'"

标签 android automation robotium

我的问题似乎与这里的 Test run failed: Instrumentation run failed due to 'Process crashed.' when testing multiple Android activity 略有不同
我已按照 in the pdf 给出的步骤进行操作.我已经创建了测试项目“TestAndroidCalculatorBlackbox”(我们是否需要有两个项目一个测试和一个主项目,也许这可能是原因,因为在 Robotium“入门”链接中他们希望我们为记事本创建项目),
并添加jars robotium-solo-5.0.1.jar,robotium-solo-1.6.0.jar,去掉下面的红色错误行solo. 函数和 jay.way 包
我附上错误截图: 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"

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

关于Android 测试项目崩溃,错误 "Test run failed: Instrumentation run failed due to ' 进程崩溃 .'",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21605221/

相关文章:

java - 以编程方式清除应用程序缓存?

android - 如何等待 Activity 在 Robotium 中加载其 View ?

android - 运行Android单元测试后如何从模拟器自动卸载应用程序

java - 保存和获取具有共享首选项的微调项目

Android/Kotlin - 如何循环所有 ToggleButtons 以形成 if/else 的条件

jquery - 相对于内容的 div 宽度

android - Robotium:仅单击 alertDialog 中的文本,而不单击下方 Activity 中的文本

eclipse - 为所有测试项目添加 Robotium

android - 为什么在 Android Studio 4.0.1 上有错误 NotAfter : Fri Jul 09 01:43:44 ICT 2021?

automation - 以编程方式向 Visual Studio 2017 的 "External tools"菜单添加一个条目