I had started android development in 2012. I have always remembered it as a painful experience for number of reasons. First problem with Android was of version fragmentation. There were too many android OS versions that were active and every one of them had improvements that were not very consistent with the previous versions so in order to give more seamless experience you had to rely on support libraries. Interestingly, there were multiple versions of support libraries as well.
The problem was compounded by documentation which often did not offer the right solutions. For example for a long time Android's official documentation suggested that you use AsyncTask for internet IO. In reality this was a horrible advice because AsyncTasks are not really meant for this sort of internet IO and there could only be two AsyncTasks running at the same time.
UI and the code that controls UI was separated using XML files for layout and Java Activity or Fragment classes that wired up events to the UI represented in XML. Again here there were countless problems. Android supported different themes which were essentially all over the place. How do you show a top bar ? There were far too many ways to achieve that each way inconsistent with some theme or another.
None of these problems were insurmountable. In fact android was getting better with each version. The problem was that the developer experience was getting terrible.
Build system pains
Android opted for Gradle to manage its build process and it was a nightmare and it remains so. I have many apps that are live occasionally I try to rebuild them and things fall apart for no good reason. It is hard to debug and it is hard to understand what exactly that build.gradle does. It takes a while to understand what all is happening there.
Then you run into an error where the android's virtual machine supported only max of 65K java methods. Then constantly changing gradle syntax where you had to replace "compile" with "implementation" and several other changes.
If that was not enough you had to manually configure to strip out unused code from the app to make the APK smaller.
Compared to iOS
Compared to all this Apple's developer ecosystem was doing much better. The Objective C was a painful language to learn. But move to Swift was very pleasant. Building UI was simpler though for some people who prefer more declarative syntax it was a bit of magic. But the build process worked pretty well and you could make a hello world app and upload it to app store in a day.
Architecture
My biggest pain with Android development however was the lack of standard best practices on how you should architect your complex app. How do I split my UI components ? How do I separate network communication from rest of the application logic ? How do I make it fault tolerant ? Which network library is ideal ? How do I manage different levels of persistence ? How to handle notifications ?
There was no real recommendation from Google on how to achieve this objectives and if you are a self learner than this was terrible because Google's official documentation always recommended the wrong ways of doing things because it was the simpler way to do things.
What is modern android ?
In year 2023, Android development has substantially improved and has become much easier [1]. The aspects that make is easier are as follows.
Kotlin
Kotlin is a language developed not by Google but by Jetbrains which is the company behind the popular IDE IntelliJ. Since 2019 it was the preferred language of Android development by Google. It find this surprising because Google is home to another excellent language called Dart which isa already used for front end development in Flutter. It had similar features as Kotlin (though not interoperable with Java).
But in any case Kotlin is definitely easy to learn and easy to write language compared to Java which avoids needless verbosity without losing expressive power of Java. It certainly matches up with Apple's Swift.
Compose
I have done a lot of Flutter and React development and I absolutely loved their ways of building UI. You define UI in code by composing a complex UI component from a simpler component. Unlike in Android where you have no clue what the UI looks like when you look at the Java code, Flutter and React was much more easy to write and read.
Google has finally brought that same paradigm to Android development through its Compose library.
@Composable
fun Greeting(names: List<String>) {
for (name in names) {
Text("Hello $name")
}
}
This simple code create a UI where you can list several Text elements. Imagine writing he same in Java. It would be a LOT of code.
In my opinion Google might have actually taken Flutter's way of building UI in designing this Compose library and it has certainly simplified a lot of work for us.
Jetpack
Jetpack is basically collection of libraries that replace all the support libraries and provide you with a new sent of libraries which you can use and rely upon as the OS improves because unlike the appcompat libraries of past, Jetpack will give you more consistent and reliable interface for doing things like creating Activities, Fragments, Databindings and so on.
Better backward compatibility
Google has worked very hard to make life easier for us to move on to a new Android version from an older one. Yes, this is not exactly painless and still we might have to fix few things manually but unlike in past, we have better tooling around achieving this.
Architectural recommendations
What however has made the greatest difference in my opinion is that Google has finally started actually recommending how you build your apps instead of giving you documentation around disjoint OS features. [2] This has resulted into people reading Google's sample code and using it to build their own apps which creates familiar and better patterns everywhere.
Their sample apps like Sunflower app and Now in Android Apps are beautiful and actually properly built instead of being just some ill maintained example apps like in past.
Android studio has gotten better
Android studio has been around for a long time but only in last 2 years it looks as solid as Apple's XCode. It has seen several performance improvements and better tooling, especially when it comes to building UI.
Android now is at more places than before
Android today not only powers smartphones but it also powers cars through Android Auto, Televisions through Android TV and many other different form factors. All these tools and improvements makes life easier not just for app developers but also developers targeting television and automobiles.
Conclusion
I will be spending some time on this blog to take you through a journey of building some excellent fun Android apps and give you detailed tutorials.
[1] https://developer.android.com/modern-android-development ↗