Android @ override Error Reporting Solution

Source: Internet
Author: User

Symptom:
... Java: 1801: method does not override a method from its superclass @ override...

Cause:
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 ).

That is to say, the Java 1.5 compiler overwrites the method of the parent class by default and uses @ override to describe it; but 1.6 has extended to the method of the interface; therefore, an error occurs if it is still compiled using the Java 1.5 compiler.

Solution:
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.
The Java compiler is of version 1.6 and the compilation level is 1.6. However, it is important to select the android library of build as 1.5 and generate the APK.ProgramYes, it can run on the 1.5 kernel.

Solution:
In eclipse, select window-> preferences-> JAVA-> compiler to select 1.6. If not, select onfigure project specific settings in compiler to set the compiler version to 1.6.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.