androidkotlinandroid-studioandroid-jetpack-composeandroid-xml

How NOT to create projects with Jetpack Compose using Android Studio


I can't create a normal project without jetpack-compose, it always includes its libraries and configurations in Android Studio, and the working project requires not using it.

I don't want Jetpack Compose

I expected it to open everything with xml views, everything normally, and using ActivityCompat in the MainActivity.kt


Solution

  • To future readers: If you are new to Android development please keep in mind that XML layouts are an outdated technology. Though still mostly working fine the foreseeable future lies with Compose instead and XML layouts are not likely to ever come back into fashion.

    If your development guide uses XML layouts then please use another guide that explains how to use Compose, like the official tutorial.

    If you still want to know how to create a new Android project using XML layouts then read on. You have been warned.


    During project creation the template that is selected by default is "Empty Activity". That is the modern way to create Android apps and uses Compose, but when you want to create a new project based on XML layouts and views you should select any of the "Views" templates instead:

    The new project won't contain any Compose dependencies but starts with a set of XML layout files and the respective code in the activity, depending on the specific template you chose.