【发布时间】:2014-01-10 01:20:49
【问题描述】:
我收到此错误“令牌“}”的语法错误,请删除此令牌。”在最后一行,我不知道为什么,因为我是 Android 新手。
public void ok() throws UiObjectNotFoundException{
//trying to find ok
try{
UiObject okDialog = new UiObject(new UiSelector().text("ok"));
if(okDialog.exists()){
System.out.println("Success");
break;//if ok exists it should come out
}
//if ok not exists
if(!okDialog.exists()){
System.out.println("retrying");
getUiDevice().pressHome();
UiObject enterButton = new UiObject(new UiSelector().text("enter"));
enterButton.clickAndWaitForNewWindow();
}
//validating again to check ok exists
if(okDialog.exists())
break;
else //if ok not exists again printing the belwo message
System.out.println("unable to find");
getUiDevice().pressHome();
//Here if ok not exists after going to home, i want to stop the whole script here..how to do this?
}catch (UiObjectNotFoundException e) {}
}
} Error message appears here : Syntax error on token "}", delete this token
【问题讨论】:
-
你是开发者???
-
从您的代码中删除最后一个“}”。或者完美地检查你的整个班级。
-
我刚开始学习。
-
@CapDroid 你能回答我这个问题吗? stackoverflow.com/questions/20715655/…
-
@user3089474 , if条件不能加break,需要
return而不是break
标签: android eclipse syntax token