Discussion:
Instrumentation failing with classnotfound on android.test.InstrumentationTestRunner
Carl H.
2008-08-22 11:18:52 UTC
Permalink
Hello,

I am trying to follow the post on ApplicationInstrumentation:
http://code.google.com/android/samples/ApiDemos/tests/src/com/android/samples/AllTests.html
http://code.google.com/android/samples/ApiDemos/tests/src/com/android/samples/ApiDemosApplicationTests.html

My setup is very similar then the example. I have the following in my
manifest:
<instrumentation xmlns:android="http://schemas.android.com/apk/res/
android"
android:targetPackage="com.novoda.runbuddy"
android:name="android.test.InstrumentationTestRunner"
android:label="testInst" />

And I start the instrumentation like this:
adb shell am instrument -e class com.android.samples.AllTests -w
com.novoda.runbuddy/android.test.InstrumentationTestRunner

I get the following error message:
INSTRUMENTATION_RESULT: shortMsg=Unable to instantiate instrumentation
ComponentInfo{com.novoda.runbuddy/
android.test.InstrumentationTestRunner}:
java.lang.ClassNotFoundException:
android.test.InstrumentationTestRunner in loader
***@433f3350
INSTRUMENTATION_RESULT: longMsg=java.lang.RuntimeException: Unable to
instantiate instrumentation ComponentInfo{com.novoda.runbuddy/
android.test.InstrumentationTestRunner}:
java.lang.ClassNotFoundException:
android.test.InstrumentationTestRunner in loader
***@433f3350
INSTRUMENTATION_CODE: 0


I tried different combination and can not make the above work. The
documentation is sparse so I am not sure where I am going wrong. Why
would I get a class not found on android.test? There is no need for
permission from what I take with the new SDK.

Any ideas?
./Acsia
Carl H.
2008-08-22 11:50:32 UTC
Permalink
Note that the cmd line is:

adb shell am instrument -e class com.novoda.runbuddy.AllTests -w
com.novoda.runbuddy/android.test.InstrumentationTestRunner

and not as previously stated:
adb shell am instrument -e class com.android.samples.AllTests -w
com.novoda.runbuddy/android.test.InstrumentationTestRunner

The error is still apparent
Post by Carl H.
Hello,
I am trying to follow the post on ApplicationInstrumentation:http://code.google.com/android/samples/ApiDemos/tests/src/com/android...http://code.google.com/android/samples/ApiDemos/tests/src/com/android...
My setup is very similar then the example. I have the following in my
        <instrumentation xmlns:android="http://schemas.android.com/apk/res/
android"
                android:targetPackage="com.novoda.runbuddy"
android:name="android.test.InstrumentationTestRunner"
                android:label="testInst" />
 adb shell am instrument -e class com.android.samples.AllTests -w
com.novoda.runbuddy/android.test.InstrumentationTestRunner
INSTRUMENTATION_RESULT: shortMsg=Unable to instantiate instrumentation
ComponentInfo{com.novoda.runbuddy/
android.test.InstrumentationTestRunner in loader
INSTRUMENTATION_RESULT: longMsg=java.lang.RuntimeException: Unable to
instantiate instrumentation ComponentInfo{com.novoda.runbuddy/
android.test.InstrumentationTestRunner in loader
INSTRUMENTATION_CODE: 0
I tried different combination and can not make the above work. The
documentation is sparse so I am not sure where I am going wrong. Why
would I get a class not found on android.test? There is no need for
permission from what I take with the new SDK.
Any ideas?
./Acsia
Megha Joshi
2008-08-22 22:05:05 UTC
Permalink
Did you notice there is one more AndroidManifest.xml file under the /tests
folder in ApiDemos...perhaps you are missing that...
We will add more information to the docs ...
Post by Carl H.
adb shell am instrument -e class com.novoda.runbuddy.AllTests -w
com.novoda.runbuddy/android.test.InstrumentationTestRunner
adb shell am instrument -e class com.android.samples.AllTests -w
com.novoda.runbuddy/android.test.InstrumentationTestRunner
The error is still apparent
Post by Carl H.
Hello,
http://code.google.com/android/samples/ApiDemos/tests/src/com/android...http://code.google.com/android/samples/ApiDemos/tests/src/com/android.
..
Post by Carl H.
My setup is very similar then the example. I have the following in my
<instrumentation xmlns:android="
http://schemas.android.com/apk/res/
Post by Carl H.
android"
android:targetPackage="com.novoda.runbuddy"
android:name="android.test.InstrumentationTestRunner"
android:label="testInst" />
adb shell am instrument -e class com.android.samples.AllTests -w
com.novoda.runbuddy/android.test.InstrumentationTestRunner
INSTRUMENTATION_RESULT: shortMsg=Unable to instantiate instrumentation
ComponentInfo{com.novoda.runbuddy/
android.test.InstrumentationTestRunner in loader
INSTRUMENTATION_RESULT: longMsg=java.lang.RuntimeException: Unable to
instantiate instrumentation ComponentInfo{com.novoda.runbuddy/
android.test.InstrumentationTestRunner in loader
INSTRUMENTATION_CODE: 0
I tried different combination and can not make the above work. The
documentation is sparse so I am not sure where I am going wrong. Why
would I get a class not found on android.test? There is no need for
permission from what I take with the new SDK.
Any ideas?
./Acsia
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-***@googlegroups.com
To unsubscribe from this group, send email to
android-developers-***@googlegroups.com
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---
Carl H.
2008-08-23 08:02:58 UTC
Permalink
Hi Megha,

I did not notice that no, was looking at the site. I tried to add the
second androidManifest to my project under the "acceptance" folder
which is my test folder. When I try to compile and install the app
onto the device, I get the following error:

08-23 07:58:21.129: WARN/PackageParser(54): Unable to read
AndroidManifest.xml of /data/app/vmdl31345.tmp
08-23 07:58:21.129: WARN/PackageParser(54):
java.io.FileNotFoundException: AndroidManifest.xml

I did follow the instruction on changing the package name etc... I
have several questions:

1. Do I need to have the instrumentation in another app - thus
installing 2 different apps (signing them correctly I suppose)?
2. Why do you use the permission run_instrumentation? I thought there
was no need for it in 0.9?

More documentation here would be much appreciated indeed!

Thanks,
Car aka acsia
Post by Megha Joshi
Did you notice there is one more AndroidManifest.xml file under the /tests
folder in ApiDemos...perhaps you are missing that...
We will add more information to the docs ...
Post by Carl H.
adb shell am instrument -e class com.novoda.runbuddy.AllTests -w
com.novoda.runbuddy/android.test.InstrumentationTestRunner
 adb shell am instrument -e class com.android.samples.AllTests -w
com.novoda.runbuddy/android.test.InstrumentationTestRunner
The error is still apparent
Post by Carl H.
Hello,
http://code.google.com/android/samples/ApiDemos/tests/src/com/android....
..
Post by Carl H.
My setup is very similar then the example. I have the following in my
        <instrumentation xmlns:android="
http://schemas.android.com/apk/res/
Post by Carl H.
android"
                android:targetPackage="com.novoda.runbuddy"
android:name="android.test.InstrumentationTestRunner"
                android:label="testInst" />
 adb shell am instrument -e class com.android.samples.AllTests -w
com.novoda.runbuddy/android.test.InstrumentationTestRunner
INSTRUMENTATION_RESULT: shortMsg=Unable to instantiate instrumentation
ComponentInfo{com.novoda.runbuddy/
android.test.InstrumentationTestRunner in loader
INSTRUMENTATION_RESULT: longMsg=java.lang.RuntimeException: Unable to
instantiate instrumentation ComponentInfo{com.novoda.runbuddy/
android.test.InstrumentationTestRunner in loader
INSTRUMENTATION_CODE: 0
I tried different combination and can not make the above work. The
documentation is sparse so I am not sure where I am going wrong. Why
would I get a class not found on android.test? There is no need for
permission from what I take with the new SDK.
Any ideas?
./Acsia
Josh Guilfoyle
2008-08-25 22:49:21 UTC
Permalink
I have made this work correctly and discuss it on my blog here:

http://devtcg.blogspot.com/2008/08/android-instrumentation-example.html
Post by Carl H.
Hi Megha,
I did not notice that no, was looking at the site. I tried to add the
second androidManifest to my project under the "acceptance" folder
which is my test folder. When I try to compile and install the app
08-23 07:58:21.129: WARN/PackageParser(54): Unable to read
AndroidManifest.xml of /data/app/vmdl31345.tmp
java.io.FileNotFoundException: AndroidManifest.xml
I did follow the instruction on changing the package name etc... I
1. Do I need to have theinstrumentationin another app - thus
installing 2 different apps (signing them correctly I suppose)?
2. Why do you use the permission run_instrumentation? I thought there
was no need for it in 0.9?
More documentation here would be much appreciated indeed!
Thanks,
Car aka acsia
Post by Megha Joshi
Did you notice there is one more AndroidManifest.xml file under the /tests
folder in ApiDemos...perhaps you are missing that...
We will add more information to the docs ...
Post by Carl H.
adb shell am instrument -e class com.novoda.runbuddy.AllTests -w
com.novoda.runbuddy/android.test.InstrumentationTestRunner
 adb shell am instrument -e class com.android.samples.AllTests -w
com.novoda.runbuddy/android.test.InstrumentationTestRunner
The error is still apparent
Post by Carl H.
Hello,
http://code.google.com/android/samples/ApiDemos/tests/src/com/android....
..
Post by Carl H.
My setup is very similar then the example. I have the following in my
        <instrumentationxmlns:android="
http://schemas.android.com/apk/res/
Post by Carl H.
android"
                android:targetPackage="com.novoda.runbuddy"
android:name="android.test.InstrumentationTestRunner"
                android:label="testInst" />
 adb shell am instrument -e class com.android.samples.AllTests -w
com.novoda.runbuddy/android.test.InstrumentationTestRunner
INSTRUMENTATION_RESULT: shortMsg=Unable to instantiateinstrumentation
ComponentInfo{com.novoda.runbuddy/
android.test.InstrumentationTestRunner in loader
INSTRUMENTATION_RESULT: longMsg=java.lang.RuntimeException: Unable to
instantiateinstrumentationComponentInfo{com.novoda.runbuddy/
android.test.InstrumentationTestRunner in loader
INSTRUMENTATION_CODE: 0
I tried different combination and can not make the above work. The
documentation is sparse so I am not sure where I am going wrong. Why
would I get a class not found on android.test? There is no need for
permission from what I take with the new SDK.
Any ideas?
./Acsia
Loading...