【 tulaoshi.com - 编程语言 】
现象:
... 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