How to compile a resource file under the framework modified by android?

Source: Internet
Author: User

How to compile a resource file under the framework modified by android?

After adding a resource file under framework/base/core/res, You need to compile the resource and then compile the framework for normal reference.

Go to the project root directory cd frameworks/base/core/res/execute the mm command (native or Qualcomm) and compile the framework-res.apk

Or./mk mm frameworks/base/core/res (mtk depends on the Compilation commands of different platforms)

After compilation, a resource reference is generated in com. android. internal. R.

Execute mm to compile framework. jar (native or Qualcomm) in the directory frameworks/base)

Or./mk mm frameworks/base (mtk depends on the Compilation commands of different platforms)

 

If there are modifications under frameworks/base/services, compile

Frameworks/base/services/java/execute mm compilation services. jar

Or./mk mm frameworks/base/services/java

 

Run the following command:

Adb remount

Adb push framework-res.apk/system/framework/

Adb push framework. jar/system/framework/

Adb push services. jar/system/framework/(if any)

 

Some systems also generate secondary_framework.jar after compiling the framework.

Also push.

After the push is complete, you can run cd system/framework to enter the directory,

Then ll two lower-case L commands to confirm whether the push is successful

 

Adb reboot restarts the device.

 


In android, how can I view the changed effect after the framework layer code is changed?

1. the following method applies to the real machine: Download the android source code, compile the modified framwork code, generate framework. jar, push it to the system/framework directory, and restart the machine! OK

2. The following method is suitable for simulators:
(1) decompress the package with unyaffs. In the sdk directory you downloaded, replace system. img with the framework. jar and compress it into a new system. img. Then, start the simulator and OK.

(2): You can also directly compile the source code and generate system. img to replace system. img in the simulator.

How does android compile the framework?

During development, especially for Framework-related development, you may need to re-compile the resource file. The compilation sequence and precautions are as follows:
1. Resource file location: frameworks/base/core/res
2, the file generated after compilation: framework-res.apk additional com. android. internal. R will update this R. the Directory of java is/out/target/common/R/com/android/internal.
3. After compiling resources, you must re-compile framework. jar.
4. If the execution of mm in frameworks/base/core/res is not re-compiled, use the toutch ### command
### Indicates a file in the directory.
5. The resource file must be in lower case.
6. If you do not need to compile resource files, you can use resources in other ways. For example, you can use adb push to upload resources to a specific object.
Directory directly in the program. I encountered some strange problems during resource compilation, for example, sometimes many icons will display
Error. The cause is probably related to re-compiling resources. You can try to re-compile services. jar and replace it.

For example, I want to use an image resource pic.png in windowmanagerservice.java. the sequence is as follows.
1. Copy pic.png to the location: frameworks/base/core/res/drawable.
2. Run touch pic.png in the frameworks/base/core/res/drawable directory.
3, enter the directory frameworks/base/core/res/execute mm command, compile framework-res.apk
4. After execution, com. android. internal. R will generate a reference to R. drawable. pic. You can use it in the program.
5. Execute mm compilation framework. jar in the directory frameworks/base.
6. Use com. android. internal. R. drawable. pic in WindowManagerService. java and save the file after use.
7. Go to the directory frameworks/base/services/java/and execute mm compilation services. jar.
8. Replace the jar apk file on the machine (virtual machine or real machine.
Adb push framework-res.apk/system/framework/
Adb push services. jar/system/framework/
Adb push framework. jar/system/framework/
The actual path of framework-res.apk during command execution.
9. Check the Modification result on the reboot machine. It is done!
 

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.