Alright, so I've spent a good 3 days now combing the net trying to figure out how to run some unit tests with ant from the command line for my eclipse project.

I can run the tests in Eclipse via "Run As" -> "Android JUnit Test"

What I want now is to be able to run the tests via the command line. That's it.

I can't seem to find any guides on this that were not written in 2010, but trying to follow them nonetheless I have gotten as far as installing ant and creating a build.xml file inside my project that I copy-pasta'd from a guide. Since I can only guess at what is going on in the build file (have never worked with ant before), when a problem rears its ugly head I'm pretty much SOL.

Currently when I try and run it, it says "package android.app does not exist" (I'm using the Activity class), and the same for a library jar file I've included in the project's "/libs" folder.

It seems pretty clear that somewhere I'm missing some kind of path declaration, but nothing I try seems to work.

EDIT (added code):
This is MockTester.java -

```
package com.android.mocksdktester;

import static org.junit.Assert.*;
import android.app.Activity;    
import android.test.AndroidTestCase;

import com.mock.android.lib.*;

public class MockTester extends AndroidTestCase
{
    Activity mActivity;
    MockFeature mFeature;

    public MockTester()
    {   
    }

    public void testExists()
    {
        String test = null;
        assertNull(test);
    }
}

```

As you can see, not a lot going on. 
This is the build.xml file I've got, and as I mentioned, I can only make guesses as to what it's doing.

```
<?xml version="1.0"?>
<!-- to save as "build.xml" -->
<project name="Mock Unit Tests" default="run" basedir=".">
    <path id="junit_classpath"> 
        <pathelement location="C:\eclipse\plugins\org.junit_4.8.2.v4_8_2_v20110321-1705\junit.jar"/>
    </path>

    <!-- Library Project Here -->
    <fileset dir="libs" includes="*.jar"/>

    <!-- build all classes in this directory -->
    <!-- To run this: use "ant build" -->
    <!-- need to include junit.jar in the classpath -->
    <target name="build">   
        <javac srcdir="${basedir}"/>
        <echo message="Build done" />
    </target>

    <!-- Test and build all files  -->
    <!-- To run this: use "ant" (default) or "ant run" -->
    <target name="run" depends="build">
        <java taskname="Test" classname="MockTester" fork="true" failonerror="true" />
        <echo message="Unit Tests done" />
    </target>

    <!-- delete all class files -->
    <!-- To run this: use "ant clean" -->
    <target name="clean">
        <delete>
            <fileset dir="${basedir}" includes="*.class" />
        </delete>
        <echo message="clean done" />
    </target>

</project>

```

It was complaining about not seeing junit in the past but I managed to fix that. I'm just not sure what to do when it's missing Android-related classes, and a jar file included in the project (though I've read this is a bug).

Errors:

```
build:
[javac] C:\<my workspace>\mock\mock_sdk_android\trunk\source\MockSDKTest\build.xml:16: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 3 source files
[javac] C:\<my workspace>\mock\mock_sdk_android\trunk\source\MockSDKTest\src\com\android\mocksdktester\MockTester.java:14:error: package android.app does not exist
[javac] import android.app.Activity;
[javac]                   ^
[javac] C:\<my workspace>\mock\mock_sdk_android\trunk\source\MockSDKTest\src\com\android\mocksdktester\MockTester.java:15:error: package android.test does not exist
[javac] import android.test.AndroidTestCase;
[javac]                    ^
[javac] C:\<my workspace>\mock\mock_sdk_android\trunk\source\MockSDKTest\src\com\android\mocksdktester\MockTester.java:18:error: package com.mock.android.lib does not exist
[javac] import com.mock.android.lib.*;
[javac] ^
[javac] C:\<my workspace>\mock\mock_sdk_android\trunk\source\MockSDKTest\src\com\android\mocksdktester\MockTester.java:20:error: cannot find symbol
[javac] public class MockTester extends AndroidTestCase
[javac]                                  ^
[javac]   symbol: class AndroidTestCase
[javac] C:\<my workspace>\mock\mock_sdk_android\trunk\source\MockSDKTest\src\com\android\mocksdktester\MockTester.java:22:error: cannot find symbol
[javac]     Activity mActivity;
[javac]     ^
[javac]   symbol:   class Activity
[javac]   location: class MockTester
[javac] C:\<my workspace>\mock\mock_sdk_android\trunk\source\MockSDKTest\src\com\android\mocksdktester\MockTester.java:23:error: cannot find symbol
[javac]     MockFeature mFeature;
[javac]     ^
[javac]   symbol:   class MockFeature
[javac]   location: class MockTester
[javac] 6 errors

BUILD FAILED

```

Thanks