Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1000531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:31:41+00:00 2026-05-16T07:31:41+00:00

I have a simple HelloWorld Activity that I try to test with an Android

  • 0

I have a simple HelloWorld Activity that I try to test with an Android JUnit test. The application itself runs like it should but the test fails with an

“java.lang.RuntimeException: Unable to resolve activity for: Intent { action=android.intent.action.MAIN flags=0x10000000 comp={no.helloworld.HelloWorld/no.helloworld.HelloWorld} }
at no.helloworld.test.HelloWorldTestcase.setUp(HelloWorldTestcase.java:21)”

This is my activity class:

package no.helloworld;

import android.app.Activity; import

android.os.Bundle;

public class HelloWorld extends
Activity {

@Override

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
} }

And the test:

public class HelloWorldTestcase extends ActivityInstrumentationTestCase2 {

private HelloWorld myActivity;
private TextView mView;
private String resourceString;
public HelloWorldTestcase() {
    super("no.helloworld.HelloWorld", HelloWorld.class);
}

@Override
protected void setUp() throws Exception {
    super.setUp();
    myActivity = this.getActivity();
    mView = (TextView) myActivity.findViewById(no.helloworld.R.id.txt1);
    resourceString = myActivity
            .getString(no.helloworld.R.string.helloworld);
}

public void testPreconditions() {
    assertNotNull(mView);
}

public void testText() {
    assertEquals(resourceString, (String) mView.getText());
}

protected void tearDown() throws Exception {
    super.tearDown();
}

Why does the test fail? The activity is (of course) defined in AndroidManifest.xml and the application runs as it should.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T07:31:42+00:00Added an answer on May 16, 2026 at 7:31 am

    The package in the constructor call should match the instrumentation target in the manifest. It should be “no.helloworld” instead of “no.helloworld.HelloWorld”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple helloworld app. I am trying to tell the Activity that
I have a simple Hello World application public class TestLeaksOnFinish extends Activity { static
When running javap on a very simple HelloWorld application I have some confusion on
I have a simple servlet say com.test.HelloWorld.class then I create these folders tree: WEB-INF
This one should be simple, but I can't figure it out myself. I have
I have a simple web service operation like this one: [WebMethod] public string HelloWorld()
I am trying to create a simple test app that basically extends the Android
I've got a weird problem that I can't understand... I have a simple HelloWorld
I have a simple PHP app that prints 'hello world'. When I run it
I have simple php validation form that is halfway working. If you leave the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.