Tips for Android App Development
Some years back I took a decision to learn and make a career in mobile development. Believe me, it was one of the best decision I took in my life. It has been around 5 years and I have been lucky to work with some brilliant Android developers who are not only talented but also immensely experienced.
Now I am at this stage where I am trying to help other developers do the right things in the best possible way.
Today, I will be sharing some tips for android app development that might help you if you have just started. Let’s dive in.
1. Don’t re-invent the wheel
Initially, I didn’t use open source libraries and tried to build everything from scratch. Although it was fun to write from scratch, but it consumed a lot of time, which I could have spent in more user oriented features.
If you are facing some problem and you see that someone has solved it in a good way and people are using it then why not use it? For example- Instead of developing your own network call structure, use the existing network calls library like- Retrofit, Volley, OkHttp.
2. Read code as much as you can
We should make it a habit of reading well written code of popular libraries/frameworks/apps regularly that will not only help you to improve yourself but also will give you different good solutions of the same problem. The code you are writing today is because you learnt it from somewhere.
The more you read the more you learn — The more you learn the more you earn 🙂 The best part of Android is that it is open source.
3. Always follow coding standards
Your code should be clean, short, properly documented. In short it should be readable because it may be possible that someone in this universe is reading your code. Make sure that he/she enjoys it thoroughly. After all it’s like your handwriting. I believe that you don’t want people to get frustrated and pull their hair out reading code that you have written.
4. Check twice, and then once more, before using any Library
On GitHub, there are thousands of open source libraries available that are free. But never get too excited and start using it without checking the ‘Stars’ and ‘Likes’ that library has. The more popular the library, the better it might be. Because we should make sure that the code we are going to use should be reliable, bug-free.
You can try running the library directly from command line using Dryrun.
5. Use ProGuard
Don’t make a mistake to publish your apps without using ProGuard, which is very useful because it not only reduces the size of the APK but also obfuscates the code. It’s totally free and bundled with the Android SDK itself.
Note: You can also take a look at DexGuard for securing your apps.
6. Use proper Android architecture
You will start loving coding if you are working with a proper Android architecture in your application.
You can use MVP (Model-View-Presenter) architecture that is highly recommended nowadays. It improves the code flexibility and reduces maintenance time.
Note: You can look at the proper implementation of MVP using this Github link.
7. User interface must be self-explanatory
You might have heard this — User interface is like a Joke, if you have to explain it then it’s bad! There are several applications that are rich in functionality but their UI is horrible.
Your design should be clean, neat, more user-friendly and easy on the eyes so that users who are using your application can enjoy it. You should try to bring out the hidden designer inside you.
Always try to remove the elements that are hard to use. Try to design your user interface as simple as you can.
Note: In order to learn more about human-centric design, The Design of Everyday Things is a good place to start.
8. Analytics is your new best friend (only for development)
It is good to rely on some analytics tools that can analyze the performance and usage of your application.
Whatever you are doing, it can’t be perfect. Even the best written code can fail once your product runs on the different devices and OS.
With the help of analytics, you can find the bugs in your application and can analyze what your users actually want. Firebase is now a good analytics platform for tracking user analytics.
Note: If you are planning to use the Firebase Analytics, I would suggest checking this link.
9. Try to optimize your code
Writing code and writing optimized code (that works in every condition) are two completely different things. The optimized code also consumes less memory. If you are not taking care of this, your app might not withstand stressful conditions. You must have also heard this — Rome wasn’t built in a day.
Memory usage by the application is also an important factor because we all know that a small leak can sink a big ship. You can check Leak Canary’s code here that can show the memory leakage in your application.
10. Get intimate with Gradle
We all are using Android Studio that uses Gradle as build system. Gradle works great but it is slows down so much so that it becomes slower than a tortoise when your application is big.
You should keep studying the features of Gradle regularly. If you want to reduce the build time of Gradle check out this link.
11. Always use Source Code Management
Git has now become the defacto SCM system for most developers. However, Github currently does not offer private repositories for a free individual account. Try Bitbucket if you need free private repositories. I have seen many standalone developers who keep a separate copy of their project and update it every time they make any changes. This is very tedious and time-wasting idea.
I still see some newbie developers not using SCM for smaller projects, which I think is a really bad idea.
Using Github/Bitbucket is also very useful if you are working in a team and collaborating with other developers.
12. Eat, Breathe and Sleep Design Patterns
You should learn some Java design patterns that helps to solve the problem in an easy way. You would see the beauty out of the box if you are using any of the design patterns in your application.
Every developer should learn at least these design patterns- Singleton, Factory, Iterator, Builder, Dependency injection, Callback, Adapter.
Note: Check out this Github project for understanding how design patterns work.
13. Test your application again and again
You should test your application as much as possible. Remember failing fast is better than failing late.
Apart from just testing the application features and functionality, one also needs to test its performance, and that is not possible without extensively testing it and putting a lot of load on it.
Testing your application well will help it survive in critical situations, and protect users from avoidable crashes and bugs.
14. Put your app on Diet
People sometimes cancel the download if an app is taking ages to download. Always try to keep the size of your APK as small as possible by removing a plethora of unused methods. Spend some time to analyze what is going inside your APK file before going on production.
15. Let’s be grateful
We all are getting help from the people, blogs, website, books etc. Whenever you are stuck in a problem, you usually Google to find the solution. It’s because somewhere someone has skipped a date with his girlfriend, and taken the time to publish the solution for your help.
That blog or article saved your life, your job. 🙂
Now it’s your responsibility to thank that person for their amazing work!
I hope you enjoyed reading these tips for android app development as much as I enjoyed writing this. 🙂 Thank you for reading.
Originally published at blogs.quovantis.com on May 1, 2017.