I have a problem with eclipse (for java developers). I try to do an app, but when i select a java file and i click "run", Eclipse give me this error. I rename my app "AndroidFAQ". So, it appear this problem:
"AndroidFAQ does not specify a android.test.InstrumentationTestRunner instrumentation or does not declare uses-library android.test.runner in its AndroidManifest.xml".
1 Answer 1
Add to the AndroidManifest.xml the following -
<instrumentation android:name="android.test.InstrumentationTestRunner" android:targetPackage="..." android:label="..." />
<uses-library android:name="android.test.runner" />
Hope this helps.
Updated.
You can create a test project that its root directory tests/ was at the same level as the src/ directory in the main project. You can also create a new test project. This new project should have an explicit dependency on your main project. The wizard will create this and set it up correctly at the time you create the original project (if you click the checkbox)
+Hello Android
| |
| +----+src
| | |
| ... |-+my.pkg.app
| | |
| | +-MainClass.java
| |
| ...
|
|- AndroidManifest.xml
...
|
+ Hello Android Test
| |
| +----+src
| | |
| ... +--+my.pkg.app.test
| | |
| ... +-MainTest.java
| |
| ...
|
|- AndroidManifest.xml
...
In this case AndroidManifest.xml file should look like as below:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="my.pkg.app.test"
android:versionCode="1"
android:versionName="1.0">
<application>
<uses-library android:name="android.test.runner" />
</application>
<instrumentation android:name="android.test.InstrumentationTestRunner"
android:targetPackage="my.pkg.app"
android:label="Tests for my.pkg.app"/>
</manifest>
See also:
I rename my app "AndroidFAQ"is this your error? Or what?