Could not find a method callClicked(View) in the activity error when running Robotium with ant run-tests
My tests for Robotium run fine when I perform Run As > Android JUnit Test in Eclipse. However, when I t开发者_高级运维ry to run them using ant run-tests (command line or within Eclipse), I get the following:
run-tests:
[echo] Running tests ...
[exec] com.my.package.test.MySpecificFunctionalTest:INSTRUMENTATION_RESULT: shortMsg=Could not find a method callClicked(View) in the activity
[exec] INSTRUMENTATION_RESULT: longMsg=java.lang.IllegalStateException: Could not find a method callClicked(View) in the activity
[exec] INSTRUMENTATION_CODE: 0
Okay, so I finally managed to solve this. I kept thinking this was related to Android or Robotium, but it turns out one of my layouts had an "onClicked" method name, but in the activity the method name was not called "onClicked". It would still build, but when run it would fail.
精彩评论