Unable to find instrumentation target package的问题
2014-07-12 19:34
393 查看
本例为以下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相同的包名
----------------新建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相同的包名
相关文章推荐
- 【转】Andriod 单元测试 Test run failed:Unable to find instrumentation target package的问题
- Android单元测试Unable to find instrumentation target package的问题
- unable to find instrumentation target package
- Test run failed: Unable to find instrumentation target package: org.XXX.XXXX
- Android异常总结---Test run failed:Unable to find instrumentation target package
- 安卓单元测试错误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
- Test run failed:Unable to find instrumentation target package
- android单元测试Test run failed: Unable to find instrumentation target package: com.abc.wallpaper.test
- Android单元测试Test run failed: Unable to find instrumentation target package
- Test run failed: Unable to find instrumentation target package: org.XXX.XXXX
- Android Unable to find instrumentation target package
- 解决PKIX问题:unable to find valid certification path to requested target【X509TrustManager】
- 访问HTTPS时SSL/TLS证书拒绝问题 : unable to find valid certification path to requested target
- 解决PKIX path building failed的问题unable to find valid certification path to requested target
- linux内核编译中的各种问题:No rule to make target `menuconfig'&&Unable to find the Ncurses libraries
- 解决PKIX:unable to find valid certification path to requested target 的问题
- 解决PKIX问题:unable to find valid certification path to requested target
- 解决PKIX:unable to find valid certification path to requested target 的问题