Don’t write Android apps like it’s 2009!
Android Pro, built million-downloads app, YC alumni.
I write about Machine Learning and Mobile.
The following is based on my experience working on various Android apps for the past few years and seeing how the framework and the development ecosystem evolved over time.
- Avoid Async tasks, really do not use them. Kotlin coroutines (👍) or RxJava are much nicer to use.
- Don’t use Loaders, if you don’t know what they are don’t bother really.
- Don’t use bare threads or manage them on your own.
- Use a dependency injection framework, Koin is great to start with.
- Avoid dagger in your first project.
- Don’t use Guice!
- Use Jetpack Components instead of the original Android Support Libraries. And when going through old tutorials remember to replace dependencies with their
- The recommendation now is to build single Activity applications (or small number of activities) which contradicts the old advice of having a ton of activities. JetPack navigation works great if you follow this advice.
- Don’t use headless fragments for communicating between them within an activity. Maintain view state via ViewModels and shared ViewModels instead.
is great, give it a try.
- Favor Jetpack Fragments over platform Fragments.
- GCM is deprecated, use FCM instead.
- Starting in Android 8.0 (API level 26), all notifications must be assigned to a channel, without a notification channel, the notification will not appear and the system logs an error.
- Eclipse, what is that! Android Studio is great.
- Use Room if you need to manage your internal databases. You can use them with Kotlin coroutines as well.
- Use exo player for audio and video playback.
- Use Kotlin instead of Java and make use of what Kotlin has to offer instead of writing Java code disguised in Kotlin syntax.
is still great.
- Keep an eye on Compose.
Subscribe to get your daily round-up of top tech stories!