In the last article, we learn How to create a project in Android Studio and in this article we are going to explore the Android Studio.
After creating the project this screen will appear in Android Studio
In this article, we will try to learn about the App folder and Gradle Scripts
As we can see in the above image there is manifests folder, inside this folder there is a file AndroidManifests.xml. When we click on this file, we will see something like this on our screen
AndroidManifests.xml:
- This file describes essential information about our app to Operating System and Gooogle Play.
- Manifest file is required to declare the app's package name
- It is required to declare the component of the app like:
- activity
- service
- receiver
- provider
- This is the file where we have to add all uses-permission that we are using in our app. For example, if we want to read the external storage of use, then we have to add the following line in our AndroidManifests.xml file, If we want to access other things, we have to follow the same process.
- We can change the launcher icon of our app from this file.
android:roundIcon will be used on a device that uses roundIcon otherwise android:icon will be used
- In this file we declare what types of Hardware or Software feature our app requires. For example, if our app requires Bluetooth and without it, our app will not work, then we can declare this in the below way:
- We can define the intent-filter in this file.
App activities, services, and broadcast receivers are activated by intents.
For example, we can change what activity will open when our app will open means we can change the launcher activity.
In the above image, we had chosen SecondActivity as our launcher activity.
Java Folder :
In this folder, we will write the code for our apps like what will happen when we click on the button and all.
For example, in the above image, we have the file MainActivity. This file will handle the functionality of the MainActivity Screen.
res folder:
This folder is used to store the value of resources that we are using in our project like colors, strings, layout, styles and drawable.
- drawable: This folder contains the different types of images used for the development of the application. It also contains the XML drawable which are used to describe shapes (color, border, gradient), state, transitions and more.
- layout: It contains the XML code of all layouts of our project.
- mipmap: It contains our app/launcher icons (which are shown on the home screen). >It’s best practice to place our app icons in mipmap- folders (not the drawable- folders) because they are used at resolutions different from the device’s current density.
-
values: This folder contains the value of color, strings and style.
- colors.xml: The colors.xml is an XML file that is used to store the colors for the resources. We can use these colors throughout our app.
- strings.xml: It is used todefine the strings in one file so that it is easy to use same string in different positions in the android project
- styles.xml: In this file all the themes of android project are defined.
Gradle Script
build.gradle(Project:applicationName) This file is in the root folder of the project and its configuration settings apply to every module in the project. A module is an isolated piece of the bigger project. In a multi-module project, these modules have their jobs but work together to form the whole project. Most Android projects only have one module, the app module.
build.gradle(Module:applicationName.app):: The file here is in the app folder. Its build settings apply only to the app module. If there were another module, then that module would have its build.gradle file, too.
In this file we can define:
- applicationId: This is the package name of our app
- minSdkVersion: It specifies the minimum API Level on which the application is able to run.
- targetSdkVersion: It specifies the API Level on which the application is designed to run
- versionCode: It's a positive integer that's used for comparison with other version codes. It's not shown to the user, it's just for record-keeping in a way.
- versionName: This is the version string seen by the user. It isn't used for internal comparisons or anything, it's just for users to see.
- dependencies: Dependencies refer to the things that supports in building your project, such as required JAR file from other projects and external JARs like JDBC JAR or Eh-cache JAR in the class path
Happy Learning!
Top comments (0)