Developing Apps with Android Studio’s Project Tool Window - dummies

Developing Apps with Android Studio’s Project Tool Window

By Barry A. Burd

A bare-bones Android project contains over 1,000 files in nearly 500 folders. That’s a lot of stuff. If you expand some of the branches in Android Studio’s Project tool window, you see the tree shown.

java-programming-for-android-developers-2e-project-tool-window
The Project tool window displays some parts of an Android app.

For many examples, you can forget about 99 percent of the stuff in the Project tool window. You can focus on only a few of its branches.

The app/manifests branch

The app/manifests branch contains the AndroidManifest.xml file. The AndroidManifest.xml file provides information that a device needs in order to run the app. For example, an app may contain several activities. The AndroidManifest.xml file tells Android which of these activities to run when the user launches the app.

The app/java branch

The app/java branch contains your app’s Java code. In fact, the branch contains several versions of your app’s Java code. Earlier, you see three branches:

  • The com.allyourcode.a03_01 branch contains the code that the user’s device will run.
  • The com.allyourcode.a03_01 (androidTest) and com.allyourcode.a03_01 (test) branches contain extra code that you can use to test the app on your development computer.

The app/res branches

The word res stands for resources. The res branch contains extra items — items that your app uses other than its own Java code:

  • The app/res/drawable branch contains any regular-size images that your app uses.
  • The app/res/layout branch contains files that describe the look of your app’s activities.
  • The app/res/mipmap branch contains some additional images — the images of your app’s icons.

The term mipmap stands for multum in parvo mapping. And the Latin phrase multum in parvo means “much in little.” A mipmap image contains copies of textures for many different screen resolutions.

  • The app/res/values branch contains other kinds of information that an app needs when it runs.

For example, the branch’s strings.xml file may contain strings of characters that your app displays. When you first create an app, the strings.xml file may contain the line

<string name="app_name">My Application</string>

If you want Romanian users to enjoy your app, you can right-click or control-click the strings.xml file’s branch and select Open Translations Editor. In Android Studio’s Translations Editor, you can create an additional app/res/values branch (a strings.xml (ro) branch) containing the following line:

<string name="app_name">Aplicatia mea</string>

The Gradle scripts branch

Gradle is a software tool. When the tool runs, it takes a whole bunch of files and combines them to form a complete application — a single file that you can post on Google Play. Of course, Gradle can combine files in many different ways, so to get Gradle to do things properly, someone has to provide it with a script of some kind. The heart of that script is in the build.gradle (Module: app) branch of the Project tool window. That branch describes your app’s version number, minimum SDK, and other goodies.