Compile the resource file in the android source code

Source: Internet
Author: User

1. Add the resource to the corresponding directory in frameworks/base/CORE/RES/. Assume that the resource to be added is of the drawable type, if the file name is test (the suffix may be XML or PNG), put the file under frameworks/base/CORE/RES/drawable.

2. Modify framework/base/CORE/RES/values/public based on existing system resources of the same type. XML, public. there are two types of resource descriptions in XML, one is <Java-symbol/> system private resources (not public to the app ), the other is <public/> public resources (which can be accessed in the app ).

If the resource to be added is private, add <Java-symbol type = "drawable" name = "test"/> (no ID is required ), if it is public, first find the public item whose last type is drawable, and 4.1.2 The last item in the system is <public type = "drawable" name = "dialog_holo_light_frame" id = "0x010800b3"
/>, And then add <public type = "drawable" name = "test" id = "0x010800b4"/>, that is, ID is the last Id + 1 (to avoid ID conflict)

3. Execute mmin frameworks/base/CORE/RES/, compile and generate framework-res.apk, and update COM. android. internal. r. The file corresponding to this R is/out/target/common/R/COM/Android/Internal/R. java, you can check whether your resources have been added in this file. (If a mm error occurs, run the "Touch resource file" command first)

4. If a public resource is added, run make Update-API in the source code directory to update the frameworks/base/API/current.txt file.

5. Make in the source code root directory.

In addition, if you want to add a new ID in the system, for example, myid, the first step is in frameworks/base/CORE/RES/values/ids. add a column <item type = "ID" name = "myid"/> in XML. The subsequent steps are the same.


Note: in source code 4.2, the system private resources are separated into separate files symbols. XML, and public resources are still in public. xml.

Original translated from: http://blog.csdn.net/june5253/article/details/8351448

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.