我的问题似乎与这里的 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 包
。
我附上错误截图:
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/