Android 下进行单元测试 Test run failed:Instrumentation run failed due to 'java.lang.ClassNotFoundException'
2014-05-27 15:29
507 查看
废话不说,一直报错。网上介绍的都是缺少如下声明之类。
但注意的是工程配置是导出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>
但注意的是工程配置是导出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.RuntimeException'
- Android单元测试Test run failed: Unable to find instrumentation target package
- Test run failed: Instrumentation run failed due to 'java.lang.ClassNotFoundException'
- Junit+Spring-test进行单元测试,报java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotatedE
- SSH如何使用junit4进行单元测试,java.lang.IllegalStateException: Failed to load ApplicationContext 问题
- Android单元测试异常总结---Test run failed:Unable to find instrumentation target package
- 解决Test running failed: Instrumentation run failed due to 'java.lang.IncompatibleClassChangeError'
- android 单元测试Test run failed: Test run failed to complete. Expected 1 tests, received 0
- android单元测试Test run failed: Unable to find instrumentation target package: com.abc.wallpaper.test
- android 单元测试Test run failed: Test run failed to complete. Expected 1 tests, received 0
- Robotium自动化测试运行遇到问题:Test run failed: Instrumentation run failed due to 'java.lang.ClassNotFoundException'
- Test run failed: Instrumentation run failed due to 'java.lang.ClassNotFoundException'
- android进行单元测试时出现java.lang.RuntimeException: Unable to resolve activity for: Intent ……
- Android单元测试,使用ThreadingTest进行全新体验
- 【android初学日志】Test run failed: Test run incomplete. Expected 1 tests, received 0
- 对应用进行单元测试(AndroidJunitTest)
- android中ADT版本问题: java.lang.NoClassDefFoundError和conversion to dalvik format failed with error 1错误
- 使用 Visual Studio Team Test 进行单元测试和java中的测试
- Robotium Instrumentation run failed due to 'java.lang.ClassNotFoundException'
- Android异常总结---Test run failed:Unable to find instrumentation target package