I am trying to create an application which launchs UIAutomator when a button is clicked. Currently the runtime issue is NoclassDefFound for UiAutomator - I already added uiautomator jar within the build path. Any pointer how I can resolve the issue? Thanks!
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button clickMe = (Button) findViewById(R.id.button1);
clickMe.setOnClickListener(new OnClickListener () {
public void onClick(View arg0) {
Log.i("Hello", "Prior to clicking");
UiObject clickBtn = new UiObject(new UiSelector().description("Apps"));
try {
clickBtn.click();
} catch (UiObjectNotFoundException e) {
Log.i("Hello", "Error is catched");
}
Log.i("Hello", "Button is clicked");
}
});