Android异常总结---Test run failed:Unable to find instrumentation target package
2013-03-05 23:30
615 查看
本例为以下DemoDao类进行单元测试 ----------------新建DemoDao.java-------------- package com.neter.test.dao; import android.util.Log; public class DemoDao{ public void save(){ Log.i("DemoDao", "用来测试的方法"); } } ----------------新建DemoDaoTest.java-------------- package com.neter.test.dao; import android.test.AndroidTestCase; import android.util.Log; public class DemoDaoTest extends AndroidTestCase { public void testSave() { new DemoDao().save(); Log.i("DemoDaoTest", "测试"); } } -------------------------------AndroidManifest.xml-------------------------- <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.neter.test.dao" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="8" /> <application android:icon="@drawable/icon" android:label="@string/app_name"> <uses-library android:name="android.test.runner"/> <activity android:name=".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> </application> <instrumentation android:name="android.test.InstrumentationTestRunner" android:targetPackage="com.neter.test.dao" android:label="Testing"></instrumentation> </manifest> 上面配置文件中 MainActivity为android程序入口,请自已新建代码略 <uses-library android:name="android.test.runner"/>不可修改 android:name="android.test.InstrumentationTestRunner不可修改 android:label="Testing"可不写 如出现Test run failed:Unable to find instrumentation target package 是因为 android:targetPackage="com.neter.test.dao" 必须和 <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.neter.test.dao" package相同的包名 |
相关文章推荐
- Android单元测试异常总结---Test run failed:Unable to find instrumentation target package
- Test run failed: Unable to find instrumentation target package: android.support.v7.appcompat
- Android单元测试Test run failed: Unable to find instrumentation target package
- android单元测试Test run failed: Unable to find instrumentation target package: com.abc.wallpaper.test
- Test run failed: Unable to find instrumentation target package: org.XXX.XXXX
- Test run failed: Unable to find instrumentation target package: org.XXX.XXXX
- Test run failed:Unable to find instrumentation target package
- Android Unable to find instrumentation target package
- Android单元测试Unable to find instrumentation target package的问题
- Test running failed: Unable to find instrumentation info for: ComponentInfo{xxxxxxx}
- Robotium ant 报错Unable to find instrumentation info for: ComponentInfo{project/android.test.InstrumentationTestRunner}
- Android问题:Test run failed: Instrumentation run failed due to 'java.lang.RuntimeException'
- Unable to find instrumentation target package的问题
- unable to find instrumentation target package
- 【转】Andriod 单元测试 Test run failed:Unable to find instrumentation target package的问题
- 安卓单元测试错误Test run failed: Unable to find instrumentation target package解决办法
- Android Studio Unable to find instrumentation info
- Android studio - Failed to find target android-18
- failed to find target with hash string android
- android 单元测试Test run failed: Test run failed to complete. Expected 1 tests, received 0