Chapters

Hide chapters

Android Apprentice

Fourth Edition · Android 11 · Kotlin 1.4 · Android Studio 4.1

Section II: Building a List App

Section 2: 7 chapters
Show chapters Hide chapters

Section III: Creating Map-Based Apps

Section 3: 7 chapters
Show chapters Hide chapters

6. Creating a New Project
Written by Darryl Bayliss

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

It’s time to say goodbye to Timefighter and move on to your next app. This new app, ListMaker, allows you to create handy lists that you can look at later.

First, though, you need to create a project where the app code will reside. The previous section skipped a lot of discussion about how to create a new project because the aim of the section was to get you building an app as quickly as possible.

This chapter will go through those steps to create a project again, with each step explained.

In this chapter, you’ll:

  1. Give your project an appropriate name and initial package structure.
  2. Learn about each step of the project set-up process and the associated screens.
  3. Set up your new project, ready to edit.

Getting started

Open Android Studio, and you’ll see a welcome window like this:

There are some useful features in Android Studio worth pointing out on this screen.

  • Create New Project: Starts creating a new project for you to build your app. You’ll use this later.

  • Open an Existing Project: Lets you navigate through your computer’s folders to find and open an existing Android Studio project.

  • Get from Version Control: Opens an Android Studio repository that’s pulled from the Internet and onto your computer.

Because Android Studio is built on IntelliJ, an IDE from the company JetBrains, you get access to powerful version control tools directly inside Android Studio.

Clicking Get from Version Control presents the version control systems that Android Studio supports, including Git and Mercurial. Android Studio also includes built-in support for Google Cloud and Github.

If you don’t already use another version control system, you might consider using the tools within Android Studio for versioning control.

  • Profile or debug APK: Gives you the option to select an .apk file from your computer’s file system and run it on a device or emulator. This is helpful for gathering useful information about the app. The .apk file is the file produced by the Android build system.

The information you can gather ranges from the size of the app and its contents to more sophisticated information gathered during runtime, like memory usage and network activity. If you profile the Timefigher apk you will see something like:

The Timefighter .apk is open here, showing the size of the app
The Timefighter .apk is open here, showing the size of the app

  • Import project (Gradle, Eclipse ADT, etc.): Provides a way to import Android projects that have a complex build system or don’t use Gradle for their build system. If you have an Android app built using a different tool or an archive project to maintain, this is the place to go.

  • Import an Android code sample: Opens a window to showcase a collection of example projects, provided by Google to demonstrate Android features. You can find Android Studio projects covering most topics. From using emojis in your app, to more technical topics such as keeping your users’ data secure.

With the options available at the welcome window covered, it’s time to begin creating the Listmaker project. On the welcome window, click Create New Project to begin creating your app.

Creating a new Android project

After you click Create New Project, a new window appears prompting for the project type.

Targeting Android devices

The next option is the Minimum API level screen. This drop-down menu specifies the earliest version of Android your app will support.

Key Points

Getting the start of a new project right is important. By learning the choices you can make, you can make sure to make the best ones. In this chapter, you learned:

Where to go from here?

Android Studio provides ways to set up a new project as quickly as possible, depending on the needs of your app. Learning what the best project setup works for a project can save you plenty of time at the beginning.

Have a technical question? Want to report a bug? You can ask questions and report bugs to the book authors in our official book forum here.
© 2024 Kodeco Inc.

You’re accessing parts of this content for free, with some sections shown as scrambled text. Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now