Android 下进行单元测试 Test run failed:Instrumentation run failed due to 'java.lang.ClassNotFoundException'

废话不说,一直报错。网上介绍的都是缺少如下声明之类。

但注意的是工程配置是导出junit包, 路径为  project上右键 --> properties -> java build path --> order and export --> 选中 junit -->重新编译测试

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

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

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >

<activity
android:name="hp.smpf.formddx.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>

<uses-library android:name="android.test.runner" />

</application>

<instrumentation
android:name="android.test.InstrumentationTestRunner"
android:targetPackage="hp.smpf.formddx" />

</manifest>

你可能感兴趣的:(Android 下进行单元测试 Test run failed:Instrumentation run failed due to 'java.lang.ClassNotFoundException')