Sunday, 2 April 2017

Android Project Structure in Eclipse



The Project Structure in Android ADT or Eclipse and also in Android Studio is very important to understand.

We need to be aware what are the all available project files when we create an application.

The Project Structure can be seen on the left side of the Eclipse or Android Studio window.




The Project Structure contains all the java packages, classes, xml files, icons, images which we use in an Android app.

This is the Complete Project Structure.


The Src folder is called as the Source folder. 

This folder contains all the Java Packages and Java Classes that we are creating and using.


The gen folder is called as Generated java files folder.

This Folder contains automatically created java files which contains

1.BuildConfig.java file and
2. R.java files.

In which the R.java file contains the automatically generated java class which contains the automatically generated integer values for every thing you are using in a project.

If you see the image you can see an integer value is generated for @string/hello_world which we have used in the xml file.


we should not modify anything in this R.java class , if you do anything changes in this class it will leads to error.

The next folder is the Android sdk or platform folder which contains android.jar file, we are not going to use this one and the next folder is Android Private Libraries which contains the necessary libraries.

The assets folder consists of static files , we are not going to use this folder also.

The bin folder consists of Compiled classes and executable files.

The next and the most important , which we are going to use in every android application development is the res folder.

The res folder is called as the resource folder.

It contains the Layout folder which will contain the xml file, which will be used to design the User Interface.

Under the res folder there are two main folders need to be known

1.Layout folder and
2. Values folder

the Values folder contains

1. dimens.xml
2. strings.xml
3.styles.xml

the dimens.xml file is used to specify dimensions(size) which can be used through out the developing the application.

the strings.xml file is used to specify every text that we are going to use in our application.

the styles.xml file is used to define some styles which can be used in designing the User Interface.

we will learn about these folders in more detail in the upcoming posts.

See the following image of res folder.

  
The last and the most important file is AndroidManifest.xml file. This file is used to set which activity to be run while the application starts , means that while you are creating an application you will use more than one activity.

An activity is said to be combination of  JAVA class+ XML file, so which activity we should run first we can specify using intent-filter in the AndroidManifest file.


we will learn about the intent-filter later, if you see in this Android Manifest we can give permissions like, if we want access our phone camera , then we need to add camera permissions, like that.

This AndroidManifest.xml file is also used to generate the apk files which we will be going to upload in Google Play Store.

These are the folders in a Project , and we saw what are its usages.

In upcoming post I will post more about these folders.

Read here:

Java Concepts required to develop Android Apps