views:

131

answers:

2

I'm getting the following error whenever I try to run a test. I have also tried to load some of the samples and test them, but I get the same error.

This is generated following the tutorials found here

Thanks for any help

java.lang.RuntimeException: Unable to resolve activity for: Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=ca.imt.helloandroid.HelloAndroid/ca.imt.helloandroid.HelloAndroid }
at android.app.Instrumentation.startActivitySync(Instrumentation.java:371)
at android.test.InstrumentationTestCase.launchActivityWithIntent(InstrumentationTestCase.java:120)
at android.test.InstrumentationTestCase.launchActivity(InstrumentationTestCase.java:98)
at android.test.ActivityInstrumentationTestCase2.getActivity(ActivityInstrumentationTestCase2.java:87)
at ca.imt.helloandroid.test.HelloAndroidTest.setUp(HelloAndroidTest.java:24)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:430)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447)
A: 

Maybe the SDK ins't set up properly? try re-installing the Android SDK (http://developer.android.com/sdk/index.html)

Maj. Fail
update: I have been using SDK Platform 2.1-update1, API7, revision 2.I changed to the latest version (SDK platform 2.2, API 8, revision 1) and it worked. This will do for now, but the actual phone I'm aiming at runs 2.1, so this is still a problem.
paul
+1  A: 

Could it be that in your test class' constructor you have the following code:

public HelloAndroidTest() {
    super("com.example.helloandroid.HelloAndroid", HelloAndroid.class);
}

instead of this code:

public HelloAndroidTest() {
    super("com.example.helloandroid", HelloAndroid.class);
}

?

I just ran into a similar issue, and that was it's solution.

Amit
Thanks, this helped me solve the same thing. Also looks like in general it needs to be the package for the project, not the subpackage for the class you're testing.
sosiouxme