Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Optimization of Android Applications [closed]

I want to do optimization of my android application.

Can anyone please tell what are different ways to optimize code and performance in android?

I gone through one tool i.e. Zipalign: an Easy Optimization.

Any other tools avaliable?

Thank you.

like image 446
krunal shah Avatar asked Dec 28 '22 08:12

krunal shah


2 Answers

There's no easy tool that just magically makes your app faster (zipalign just improves loading times). You'll need to learn how to write performant code. The SDK has some useful tips: http://developer.android.com/guide/practices/design/performance.html

If you have some CPU-intensive heavy lifting, you can rewrite that with the NDK.

Keep in mind that optimizing code will take time and can introduce bugs. Be sure to profile your code, find bottlenecks, and focus on getting those fast.

like image 100
EboMike Avatar answered Dec 31 '22 12:12

EboMike


Best practices are typically kinda obvious. Your application is most likely going to have specific unique bottlenecks. Check the android logs while your phone checks (Set a filter up) as the application runs. Check when the operating system is calling the garbage collector and how much information its removing.

If you are loading any files into memory be aware that android places (At least used to) a limit on the max size a file is (4mb) that can be loaded into memory.

What type of sensors are you using, if any... and if so in what way and is there a better way you can be using said sensors.

Are you storing to much / to little state in the application lifecycle steps.

like image 39
Steve Avatar answered Dec 31 '22 10:12

Steve