Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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.