Sunday, July 1, 2012

Error: The method onItemSelected(String) of type ItemListActivity must override a superclass method

It MAY BE happen if you new a project using the new Android SDK Revision 20: Eclipse complain with errors of:
- The method onItemSelected(String) of type ItemListActivity must override a superclass method
- The method onItemSelected(String) of type new ItemListFragment.Callbacks(){} must override a superclass method



Checking the updated System requirements of Android SDK, only JDK 6 is officially supported:



To fix it: correct Compiler compliance level to 1.6.

- Right click your project, select Properties.


-  Select Java Compiler tab, change Compiler compliance level to 1.6.


- Alternatively, you  can click Window -> Preferences, then select Java -> Compiler to change Compiler compliance level to 1.6 for the whole workspace.


Then clean and re-build. Now fixed with 0 errors.


4 comments:

  1. Yesterday I load in Eclipse the SDK revision 20 and I have found exactly with this error. And the solution proposed here was efective 100%. Thanks.

    ReplyDelete
  2. Was getting the same error while trying to build Jelly Bean Based Master-detail-flow Layout activity
    100% Fixed Now Thnx :D !!!

    ReplyDelete