The android compilation cannot find the resource ID.

Source: Internet
Author: User

The android compilation cannot find the resource ID.

Generally, the ID cannot be found for the following reasons:

1. ID Mismatch

2. xml not compiled

3. The compilation sequence is incorrect.

4. The correct resource package is not imported.

The resource files compiled under frameworks/base/CORE/RES are stored in out/target/common/R/COM/Android/Internal/R. java.

So check whether your ID is in R. Java first,

Then checkSource codeAre there:

Import com. Android. Internal. R;

Below is an extended reading

Compare android4.1 with previous versions.

In versions earlier than 4.1, add a resource (image or XML file). During compilation, the generated ID is automatically added to the public. xml file.

However, in versions 4.1 and later, the ID is not automatically generated during compilation.ProgramAdd the ID to the public. xml file.

For example

Add an image

<Java-symbol type = "drawable" name = "play_indicator_stop"/>

Layout)

<Java-symbol type = "layout" name = "select_dialog"/>

I thought that if a layout file is added, the layout file is similar

<Imageview Android: Id = "@ + ID/play_indicator"

The added ID does not need to be added to public. xml. It turns out that you still need to add the following:
<Java-symbol type = "ID" name = "play_indicator "/

This is a problem I encountered today. Later I studied the source code. Find this difference. I hope this error will stop!

-- Open source! Knowledge belongs to everyone!

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.