Creating a New Project

Most of the time, you will be doing Android development on an existing project, such as one created by somebody else on your development team.

But, on occasion, you will want to start development of a brand-new project. You have two main options for accomplishing that:

  1. Clone some existing project. An Android app project is just a directory of files, so you can make a copy of an existing app directory and modify the copy to serve as the base for your new project. We will examine that scenario later in this chapter.
  2. Use the Android Studio new-project wizard to create a brand new project. This will give you a project that resembles the HelloWorld one seen in the early chapters of this book. We will examine that scenario shortly.

Key Decisions That You Need to Make

Regardless of how you intend to start your new project, you will have a few decisions that you will need to make towards the outset.

Application ID

The most important one is the application ID. This is the unique identifier for your app:

From a technical standpoint, an application ID needs to be a valid Java/Kotlin package name (e.g., com.commonsware.this.is.valid). Beyond that, though, you want to try to avoid any accidental collisions with the application IDs of other developers.

The recommended approach is to:

The reverse domain name convention reduces the odds of accidental collisions with other developers. The app-identifying segment at the end reduces the odds of accidental collisions with other developers in your organization. Even if you are a solo developer, you might create other Android apps in the future, so having an application ID that is tied to a specific app, rather than just a domain name, is a good idea.

Unlike the other decisions in this section, this one will be somewhat difficult to change. In particular, once you start shipping the app, you cannot change the application ID. If you do, that will be considered a totally different app by Android and app distribution channels (e.g., the Play Store).

Project Directory

Your project files need to live somewhere!

Language

You can have a project that:

(there is no simple way to have a Kotlin-only project)

Switching from a Java-only to a Java-and-Kotlin project is not that difficult. However, for future-proofing, the best choice is to support Kotlin from the outset, even if you do not plan on using it for much right away.

Minimum SDK Version

The minSdkVersion indicates how old of an Android version you are willing to support.

There are competing pressures here:

From a practical standpoint, a minSdkVersion below 14 will be exceptionally difficult, as that is the minimum supported API level for the Jetpack. Certain pieces of the Jetpack have higher minimums than that, though 14 is fairly common.


Prev Table of Contents Next

This book is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license.