Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android

Android Test class

I have accidentally deleted the android test class of my app..now app is not being run on simulator..what should i do now..???

1 Answer

Alex Johnson
Alex Johnson
6,067 Points

According to this StackOverflow page, your app should run without it.

But since it's not, try creating a new class named ApplicationTest in the androidTest folder (which is probably named something like "com.yourpackage.appname (androidTest)") with the following code:

package com.yourpackage.appname; // Change this to reflect the package name of your own project

import android.app.Application;
import android.test.ApplicationTestCase;

/**
 * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
 */
public class ApplicationTest extends ApplicationTestCase<Application> {
    public ApplicationTest() {
        super(Application.class);
    }
}

Rebuild project and try to run. Let me know how it goes.