Outdated Android libraries to avoid in 2019
As we all know Android is in permanent beta and shifts rapidly. It’s confusing. That’s why programmers inexperienced in Android often use outdated libraries. In this short article I listed a few libraries that are still often used but now have better alternatives.
|Android Priority JobQueue||WorkManager|
|Application Insights/HockeyApp||App Center SDK Android|
Now it’s time to back up why I think that libraries above are outdated. And why new alternatives are worth learning. Let’s start with …
Volley -> Retrofit
Volley still works but Retrofit is just better. I think that at this point there is no point in using Volley as a go-to library unless you know it inside out.
Retrofit is much easier to use and requires less boilerplate. In my words: almost all of the implementations of Volley I have seen looked like crap compared to Retrofit. Literally, it looked even worse than it had to. I think that the reason for that is that it’s really hard to screw Retrofit implementation because it’s super simple.
Also, it works terrific in the repository pattern. If you don’t know much about this pattern and architecture, make sure to check it out. It’s essential because architecture is often overlooked in tutorials to save space and to focus on a single feature. You have to make sure that you blend features into your app properly.
I know that there are many developers who are used to Volley and don’t want to switch. If you are not one of them- use Retrofit.
Android Priority JobQueue -> WorkManager
There is no need to use this 3rd party library because of a new tool- WorkManager. The author of Android Priority JobQueue, Yigit Boyar, deprecated his library and recommended WorkManager for persistent tasks. Actually, I like WorkManager a lot too because it’s easy to use.
I picked it up and built my Worker with a reusable retry work strategy in no time when it was in alpha. Now with a stable version and more tutorials, it’s probably even easier.
But make sure that you don’t pass too much data to workers. I was really surprised when I saw a random “IllegalStateException: Data cannot occupy more than 10240 bytes when serialized” on production. The 10kB limit seemed to be enough.
GreenDAO -> ObjectBox
This one might be controversial. GreenDAO and ObjectBox came from the same company. The main difference is GreenDAO = ORM for SQLite DB, whereas ObjectBox is a new solution that doesn’t use SQL at all.
A lot of developers have concerns with flexibility and corner cases. I also have some and I use Room as my favorite tool but on the other hand, ObjectBox is much simpler. Also, it’s good for people who are not good at relationships. Huh. Or people who want to save time.
So if you are looking for something fast, light and simple, check out ObjectBox. Although I haven’t used it long enough in pet projects, to give it a try in something bigger, I know good developers who swear by it.
But does ObjectBox make GreenDAO outdated? It’s not clear but it rather does because of a note from official GreenDAO documentation:
“Note: for new apps we recommend ObjectBox, a new object-oriented database that is much faster than SQLite and easier to use. For existing apps based on greenDAO we offer DaoCompat for an easy switch (see also the announcement).”
Application Insights/HockeyApp -> App Center
These 2 are officially deprecated by MS Azure and are replaced with App Center SDK for Android. App Center is a big library but the good thing is that it uses a modular architecture so you can use any or all of their services. For example, you can use only Analytics service, and it’s a separate dependency from for example Crashes collecting.
AsyncTask -> RxAndroid/Coroutines
Both RxAndroid and Coroutines are much better than AsyncTask. However, these tools should be used in different scenarios. That’s because using RxAndroid for managing simple async work might be overkill. It’s useful when you need powerful event processing operators. And it offers gazillions of them.
Some people point out that Coroutines are less mature. But if you decide to use them, you have tons of support online and it’s now officially supported by Google.
So in terms of these 2 libraries, see them as complementary tools. Nevertheless, avoid AsyncTask.
But if you use Java and RxAndroid seems to be an overkill, check out ThreadPoster article by Vasiliy Zukanov.
There are many outdated libraries still used in old StackOverflow replies and even in 2019 tutorials. Today some of them have great alternatives that are worth checking out. I know that there are more good examples so leave a comment if you have any in your mind.
If you want to be notified about more articles like this one, subscribe below.