Add image to Android project, error cannot be resolved or was not a field

Source: Internet
Author: User

SDK and ADT are version 22.6.2

Works for 4.4.2

Today, when writing Android code, adding a few pictures to the project, and then using the r.drawable call in the code, has been an error cannot be resolved or was not a field

Then I looked at the Gen directory of the R.java file, found that I have added to the image of the resource ID, it is very strange, is generally unable to generate R.java files when this phenomenon will appear ah

On the internet did not see the information can solve my problem, and then I took my code from start to finish again, and did not find anything unusual, suddenly, when I look at the file header code, found a suspicious code import Android. R; I try to delete this line of code, unexpectedly good, now for a moment do not want to understand why, but my problem solved, if there is any gaoren know, trouble tell Ah!

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.