1、首先建立Android工程
2、在工程的build.gradle(Modul:app)中添加依赖
3、注意下gradle的版本和对应appcompat-v 的版本要相对应,不然这里有可能报错
4、写简单的代码:
import android.app.Instrumentation;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import android.support.test.uiautomator.By;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.Until;
import android.util.Log;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.io.IOException;
/**
* Instrumented test, which will execute on an Android device