Android Tutorial : Android Project Structure, Files and Resources

In last tutorial, we learned about creating a sample android app and running it in a android virtual device (AVD). In this tutorial, I am giving short introduction of the project structure of an android app, the files and folders created in android app and their usage. This information will be discussed in more detail in later tutorials, but for now, a small introduction will set the stage for moving forward.

Android app project structure
Android app project structure

1) Project Root Content / Folders

When you create a new Android project (e.g., via android create project), you get several items in the project’s root directory, including:

  1. AndroidManifest.xml which is an XML file describing the application being built and what components — activities, services, etc. — are being supplied by that application
  2. bin/ folder which holds the application once it is compiled (note: this directory will be created when you first build your application. Usually, in eclipse “auto build” is enabled, so you will get it directly after project is created.)
  3. res/ folder which holds “resources”, such as icons, GUI layouts, and the likes, that will get packaged with the compiled application
  4. src/ folder which holds the Java source code for the application
  5. lib/ folder which holds extra jar files required at runtime, if any
  6. assets/ folder which holds other static files you wish packaged with the application for deployment onto the device
  7. gen/ folder holds source code that Android’s build tools generate

2) Java Source Code

When you created the project (e.g., via android create project), you supplied the fully-qualified class name of the “main” activity for the application (e.g., com.howtodoinjava.DemoApp). You will then find that your project’s src/ tree already has the package’s directory tree in place, plus a stub Activity subclass representing your main activity (e.g., src/com/howtodoinjava/ You are welcome to modify this file and add others to the src/ tree as needed to implement your application.

The first time you compile the project out in the project’s package’s directory, the Android build chain will create This contains a number of constants tied to the various resources you placed out in the res/ directory tree.

You should not modify yourself, letting the Android tools handle it for you.

3) Android App Resources

You will also find that your project has a res/ directory tree. This holds “resources” — static files that are packaged along with your application, either in their original form or, occasionally, in a preprocessed form. Some of the sub-directories you will find or create under res/ include:

  1. res/drawable/ for images (PNG, JPEG, etc.)
  2. res/layout/ for XML-based UI layout specifications
  3. res/menu/ for XML-based menu specifications
  4. res/raw/ for general-purpose files (e.g,. an audio clip, a CSV file of account information)
  5. res/values/ for strings, dimensions, and similar things
  6. res/xml/ for other general-purpose XML files you wish to ship with your app

Some of the directory names may have suffixes, like res/drawable-hdpi/. This indicates that the directory of resources should only be used in certain circumstances — in this case, the drawable resources should only be used on devices with high-density screens.

In our initial project, you will find files like:

  • res/drawable-hdpi/icon.png, res/drawable-ldpi/icon.png, and res/drawable-mdpi/icon.png, which are three renditions of a placeholder icon for your application for high-, low-, and medium-density screens, respectively
  • res/layout/main.xml, which contains an XML file that describes the very simple layout of your user interface
  • res/values/strings.xml, which contains externalized strings, notably the placeholder name of your application

4) What happen when we compile android project

When you compile your project (via ant or the IDE), the results go into the bin/ directory under your project root.

Android bin folder content
Android bin folder content


  1. bin/classes/ holds the compiled Java classes
  2. bin/classes.dex holds the executable created from those compiled Java classes
  3. bin/resources.ap_ holds your application’s resources, packaged as a ZIP file (where yourapp is the name of your application)
  4. bin/DemoApp.apk is the actual Android application

The .apk file is a ZIP archive containing the .dex file, the compiled edition of your resources, any un-compiled resources (such as what you put in res/raw/) and the AndroidManifest.xml file.

If you build a debug version of the application — you will have DemoApp-debug.apk and DemoApp-debug-aligned.apk as two versions of your APK. The latter has been optimized with the zipalign utility to make it run faster.

That’s all for this small introduction post discussing various files and folders created with every android app by default. We will discuss them in deeper as and when required in future tutorials.

Happy Learning !!

Leave a Reply

Inline Feedbacks
View all comments

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions, and frequently asked interview questions.

Our Blogs

REST API Tutorial