Android Project Overview

When you create a new Android app project from scratch it contains a lot of files and directories from the beginning. Browsing around t...

When you create a new Android app project from scratch it contains a lot of files and directories from the beginning. Browsing around these files and directories can be quite confusing when you don't know what their purposes are. Therefore I will shortly explain the core files and directories of an Android project in this text, so you can get an overview of what an Android project contains.

Here is screenshot of the directories and files in a newly created Android Studio project:

                       

As you can see, the Android project is located in some directory which contains a lot of files and subdirectories below it. I will explain these subdirectories and files below.

The app directory is the root directory of all files directly related to your app. These files and directories you are allowed to edit to some degree. By "some degree" I mean that some of the files and directories have to exist while others do not.

The src directory contains all of the source code for your Android app. Inside the src directory you have two directories called androidTest and main . The androidTest directory is for test cases for your Android project. The main directory contains the main source code for the Android app.

Inside the main directory you have two directories named java and res.

The java directory is the root of the Java source code for the Android app. In here you can put Java packages and classes like you are used to in a normal Java project. You are free to organize your code any way you like, but there is one significant restriction on your package hierarchy. The Google Play store identifies your app based on its core / root package hierarchy. Once you have published the app once to Google play, you cannot change this core / root package hierarchy if you want to publish updates to the same app via Google play.

As an example, imagine you create the core / root package structure com.jenkov.mynewapp . Inside mynewapp you will have the various classes and subpackages that make up your app. The core / root package com.jenkov.mynewapp will be used as identifier for your app in the Google Play store, so once you have published your app one time, you will have to keep this core / root package structure forever for that app.

The res directory inside the main directory contains all the non-Java sources for the Android app. The non-Java sources include various XML files and image files. Many of these files are located in subdirectories of the res directory.

One important XML file is located directly in the res directory: The AndroidManifest.xml file. The Android manifest file contains a lot of information about the Android app, including the identifying core / root package hierarchy under which your app is located (in the Java package structure). The AndroidManifest.xml file also contains information about the name and version of the Android app.

The directories which names start with drawable contains the image files used in the app. Each directory contains the images for use with different screen resolutions. Some Android devices have much higher screen resolution and pixel density than others. To make the images look good on all these devices, each image must exist in a resolution matching the device resolutions your app targets. For higher resolution screens you will have to use higher resolution images. The Android device will automatically choose the right image from these folders depending on its screen resolution and pixel density.

The layout directory inside the res directory contains the layout XML files used by the app. Layout XML files are typically used by activities, fragments and by some ViewGroups. These layout XML files specify how the GUI components in the app is to be rendered.

The menu directory inside the res directory contains the layout XML files used by the app's menu (ActionBar).

The values directory inside the res directory contains XML files with value definitions. For instance, the strings.xml file contains text labels to be displayed in the app. Having the text labels in a separate file from the app makes it easier to translate these labels to other languages without touching the Java code.

There are a few more files and directories than what I have covered here, but I have explained the most important of the files and directories.

COMMENTS

Name

Android,9,Big Data,3,Cloud Apps,1,Database,1,Featured,12,Free Downloads,1,HowTo,1,IOT,7,Java,1,Linux,1,News,6,Products,1,SEO,1,TipsnTricks,5,Ubuntu,1,Unity3D,4,Windows Apps,1,
ltr
item
Tech Geek Bytes - A Blog For News, Tutorials, Free Source Code, Tips and Tricks: Android Project Overview
Android Project Overview
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvtGFECNE2_8aSCO_bGmatZhz48X0KkZHsd5jrsihyphenhyphen5Ds3myn0iepwXwL3pmBcgG4snMFqiAakV1PmQ4nZfsTR-MdhTo_-6uEDdicEkKUb-iHHAahcActkmT5NMlb2MGKRgiWkzo7hxNs/s640/ic.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvtGFECNE2_8aSCO_bGmatZhz48X0KkZHsd5jrsihyphenhyphen5Ds3myn0iepwXwL3pmBcgG4snMFqiAakV1PmQ4nZfsTR-MdhTo_-6uEDdicEkKUb-iHHAahcActkmT5NMlb2MGKRgiWkzo7hxNs/s72-c/ic.png
Tech Geek Bytes - A Blog For News, Tutorials, Free Source Code, Tips and Tricks
https://techgeekbytes.blogspot.com/2017/06/android-project-overview.html
https://techgeekbytes.blogspot.com/
https://techgeekbytes.blogspot.com/
https://techgeekbytes.blogspot.com/2017/06/android-project-overview.html
true
8751912191394201619
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy