Android Development: some of the best practices. Jun 2016 edition.
Android Development : Some of the best practices
Hi! After a modest number of projects I’ve decided to share with you some of the things that experience made me learn…
So yeah I feel like something is missed from article up there. Let’s find out what.
- Use Kotlin, yeah it’s time! Consider it long term investment in your project and skills.
- Think twice before adding any third party library; it’s a serious commitment.
- Use only small, one-feature libraries and abstraction layer above it — would be easier to replace in future.
- Use dependency injection, it will help you to write more flexible code and tests. Dagger/Dagger2/Kodein is the best choice so far. Thanks Wahib👍
- Use Picasso or Glide for async images loading and management.
- Use DB for persistent data.
- Use OM/ORM for DB objects; save your time.
- Do not even think about Realm unless you are sure about what you are doing and how it works. Prefer to use SQLite instead.
- Try hard to prevent hitting the 65k limit, with the release of Support Library 24+ it would be much easier.
- Use RxJava for async tasks.
- Use JobScheduler for long, periodic or state-dependent tasks.
- Keep each async task as a separate class.
- Do not use RetroLambda.
- Do not use EventBus; you already have RxJava and LocalBroadcastManager.
- Do not use Guava.
- Use ConstraintsLayout to flatten your view hierarchy.
- Use DataBindings to write less UI code.
- Use AutoValue with Parcel.
- Be careful with memory leaks.
- Use the AccountManager to suggest login usernames and email addresses.
- Keep your colors.xml short and DRY, just define the palette.
Also, keep dimens.xml DRY, use universal constants.
- Test your app in “Don’t keep activities” mode.
- Test your app with unlocked screen orientation.
- Use Stetho for debug builds.
- Use Gradle build tool.
- Keep minSdkVersion=21 for development builds; it will speed up compile time, especially if you are using multidexing.
- Setup static code analysis tools for your CI builds.
- Break your app into small, flexible modules. Assemble this modules and publish it into your private or public maven repo. Add it as a library to your main project.
- Filter your logs.
Did I miss something?
P.S. Thanks for your comments, guys!
If you enjoyed this post, please hit the recommend button below and share this. Thank’s!