Why Use Two IDEs?
Android Studio is a great IDE. And so is IntelliJ. But why use IntelliJ for developing Android Apps if we can’t do any Android related things? And, that, my friend, is exactly why I use both. Let me explain.
The following bit of code from Retrofit and Coroutines is from an Android app I’m working on:
interface ApiRequest {
fun <T, R> requestFromApi(call: Call<T>, transform: (T) -> R, default: T): Either<Failure, R> {
return try {
val response = call.execute()
when (response.isSuccessful) {
true -> Either.Right(transform(response.body() ?: default))
false -> Either.Left(Failure.ServerError)
}
} catch (exception: Throwable) {
exception.printStackTrace()
Either.Left(Failure.ServerError)
}
}
}
The repository extends ApiRequest
so I can do something like this: requestFromApi(...)
. So what’s the big deal you say and what’s that have to do with IntelliJ? For the same reason I mentioned at the beginning of the post - IntelliJ can’t do Android things. It’s just a dumb stand-alone IDE.
Clean Architecture
So what makes using IntelliJ important in my development lifecycle? Clean Architecture and Separation of Concerns. It forces me to do both of those because, not only am I not tempted to, I actually can’t use Android things.
The code in the aforementioned article was all initially developed in a plain Kotlin project in IntelliJ. And here’s why. If it runs, compiles, and tests in Intellij, I can be assured that it will do the same in Android Studio without any Android or project related dependencies.
IntelliJ is my go to for initial Android development. As long as the package names are the same, when the code is ready to move to Android, all I have to do is copy the file over to the same package in the Android Studio project and it just works.
Best of Both Worlds
Stand alone IntelliJ projects have become a great tool. I actually prefer it for initial development over Android Studio because it keeps a lot of the noise down.
If you’re not already using both IntelliJ standalone and Android Studio, give it a try. You might like it.