我正在尝试创建一个在单击按钮时启动 UIAutomator 的应用程序。目前,运行时问题是 UiAutomator 的 NoclassDefFound - 我已经在构建路径中添加了 uiautomator jar。任何指针我可以如何解决这个问题?谢谢!
@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");
}
});