現象:
... java: 1801: method does not override a method from its superclass @Override...
原因:
Eclipse is defaulting to Java 1.5 and you have classes implementing interface methods (which in Java 1.6 can be annotated with @Override, but in Java 1.5 can only be applied to methods overriding a superclass method).
就是說Java 1.5的編譯器默認對父類的方法進行覆蓋,采用@Override進行說明;但1.6已經擴展到對接口的方法;所以如果還是以Java 1.5的編譯器來編譯的話,會出現錯誤。
解決方案:
Go to your project/ide preferences and set the java compiler level to 1.6 and also make sure you select JRE 1.6 to execute your program from eclipse.
java的編譯器是1.6版本的,選擇編譯級別為1.6,但重要的一點是,選擇build的android庫是1.5的即可,生成的apk程序是可以在1.5內核上跑起來。
解決方法:
在eclipse中 選擇Window –> Preferences –> Java –> Compiler 選擇1.6 ,如果還不可以,在Compiler中選擇onfigure Project Specific Settings 選擇編譯器版本為1.6