Project Structure
The Android project structure generally contains:
- app
- Manifest file
- Java/Kotlin
- res Directory
- Gradle Script
app
It describes the fundamental characteristics of the app and defines each of its components.
Manifest File
Manifest file plays an integral role as it provides the essential information about your app to the android system, which the system must have before it can run any of the app’s code.
Manifest file performs various tasks such as
- It names the Java package for the app as the package name serves as a unique identifier for the application.
- It protects the application by declaring permission in order to access protected parts of the API and interact with other applications.
- Manifest file declares the minimum level of the Android API and lists the libraries which is linked with the application.
- Manifest file list the instrumentation classes. These classes provide profiling and other information as the application runs, but this information is removed as soon the application is publishes. It remains only till the application is in development mode.
The Manifest includes many types of information, the main ones are:
- Package name
- Components of the app, such as activities, fragments and services
- Permissions needed from the user
Java/Kotlin
- This folder contains the .java/.kt source files for your project. By default, it includes an MainActivity.java source file.
- Under this, you create all the activities which have .java extensions and all the code behind the application.
- MainActivity.java is the actual file which gets converted to a dalvik executable and runs your app.
res Directory
- It is a directory for files that define your app’s user interface. You can add TextView, Button etc. to build the GUI and use its various attributes like android:layout_width, android:layout_height etc which are used to set its width and height.
- The res directory is where you put things such as images, strings and layouts. It’s included in every android project, and you can see it in Android Studio res directory.
- Inside of the res directory, are sub folders for the following types of resources. You may have a subset of these directories, depending on the types of the resources you are using in your app.
Different Resource Directories
Gradle Scripts
This is an auto generated file which contains compileSdkVersion, buildToolsVersion, applicationID, minSdkVersion, targetSdkVersion, versionCode and versionName.
Thank You!
Top comments (0)