Performance Optimization 2

Source: Internet
Author: User

 

 

Http://my.oschina.net/u/586684/blog/207844

Http://blog.csdn.net/lilu_leo/article/details/8115612#t1%EF%BC%8C%E5%85%B7%E4%BD%93%E5%81%9A%E6%B3%95%E8%AF%B7%E5%8F%82%E8%80%83%E8%AF%A5%E8%BF%9E%E6%8E%A5%EF%BC%89

 

Use proguard

Use proguard to Remove useless code and rename some classes, fields, and methods to compact your code and save memory space.



Use zipalign

Zipaligned performs byte alignment on the final packaged APK.

Note: Google Play does not accept unaligned APK.

Http://www.cnblogs.com/xirihanlin/archive/2010/04/12/1710164.html

Analyze memory usage

If a relatively stable version has been obtained, the memory usage of the entire life cycle of the program should be analyzed. Refer to here.

 

Use multiple processes

If the program needs to execute a lot of background work, you can consider dividing the program into two processes, one process is responsible for the UI, And the other process is responsible for background tasks. For example, a music player.

Sample Code:

<Serviceandroid: Name = ". playbackservice" Android: Process = ": background"/>
The value of the Android: process attribute starts with ":" and the name can be selected at will.
Before deciding whether to use a multi-process, it should be noted that a blank process that does not execute any tasks also occupies at least 1.4 MB of memory.
In addition, pay attention to the mutual dependency of processes. For example, if you place contentprovider In the UI process and the background task process also needs to call contentprovider, the UI process will remain in Ram.

 

 

 

Performance Optimization 2

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.