Search code examples
javaandroidkotlinintellij-idea

How can I create pure Java Android app projects only?


Since very recently, all new Android App projects with Android Studio and IntelliJ have been Java and I want to keep it that way. Recently however they introduce me forcibly to Kotlin, which I don't know and don't want to learn. Do I have to downgrade and block upgrades to get this functionality back to what it was, or what do I have to change to get my Java templates and old default behaviour back to what it was, say in 2022/beginning 2023?

I create a new project as always and now get *.kt files instead of *.java, and all the activity templates have become Kotlin. I have browsed all settings and can't work out where or how to change them to fall back or add the feature I want. I also can't see plugins which eventually could add the old mech.


Solution

  • Recently however they introduce me forcibly to Kotlin

    It's more that they default projects to incorporating Kotlin into the build scripts and that templates are only available for Kotlin. You can still use Java, and there's nothing that you need to add to the project to use Java.

    what do I have to change to get my Java templates

    I doubt those are coming back in terms of official support. IMHO, those templates were never very good, often demonstrating anti-patterns or using obsolete techniques. Cutting back to just Kotlin templates might help them do a better job of maintaining the smaller roster.

    There might be a plugin that offers Java templates. I am not aware of any, but I have never looked for any either.

    which I don't know and don't want to learn

    You do not have to learn Kotlin. However, please understand that you will be increasingly isolated. The Android ecosystem is moving strongly towards Kotlin, just as the iOS ecosystem moved towards Swift. Right now, trying to learn Objective-C-based iOS development is very difficult, because documentation and tooling is Swift-centric. The same thing will be true for Android app development in another couple of years.

    Also, note that certain technologies, such as Jetpack Compose, require Kotlin.

    FWIW, if you would like to at least be somewhat conversant in Kotlin, for reading documentation and blog posts and stuff, here is a free book of mine on the subject, though it is getting a bit old.