The Android project structure is designed to keep code and resources organized, making development more efficient.
Sun, 03 Nov 2024
New Project
from the home or File > New Project
when another project is opened.
finish
.
1
: App name2
: Shows the emulator or connected devices.3
: Run normally or in debug mode in device.4
: Build project.5
: Shows available devices.6
: Shows currently running devices.7
: Build steps and info.8
: Logcat containing logs, error, message.9
: Built-in terminal. (Alt + F12
)10
: Path of the currently opened file.Gradle
as build tools, so it's structure is similar to gradle.
1
: Mode of the project. Android
mode shows a minimized view of the whole structure that are mostly used by us.2 - app
: This module contains the main code written by us. We will write almost everything inside this.3 - AndroidManifest
: This can be considered as the configuration file of our app.4 - java>com>lazymind>myfirstapp
: This is the main package of our app. We will write all of our java code here.5 - MainActivity
: When we create a new project, an activity(page) is created by default. This MainActivity.java
file is that Page's Java part.6
: This will contain the code for performing unit and ui test.(ignore for now).7 - drawable
: For storing external images or icons. Ex: icons, backgrounds.8 - layout
: For storing all of our xml design files(For page design or item design).9 - mipmap
: Stores app launcher icons in different resolutions for various screen densities.10 - values
: Contains XML files for storing hardcoded resources like strings, colors, dimensions, and styles.11 - xml
: Stores custom XML files for configurations.
1 - build.gradle.kts
: Main configuration file for our whole project. It includes plugins, dependencies, configuration. We won't modify it much.2 - build.gradle.kts
: Same but only difference is that, this is for our app module. We will mostly work on it.3 - libs.versions.toml
: Contains the versions number of our dependencies.4 - settings.gradle.kts
: It specifies: project name, list of included modules, and specifies where to fetch dependencies for the project.package
.Android
mode shows a minimized version that we mostly use.Project
mode in Android Studio.
Gradle
?AndroidManifest.xml
fileAndroidManifest.xml
file:<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<application
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.SmartBoard"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="true"
tools:targetApi="s" >
<activity
android:name=".Homepage"
android:exported="false"
android:launchMode="singleTop"
android:theme="@style/AppThemeCustom" />
<activity
android:name=".StartingPage"
android:configChanges="uiMode|orientation|screenSize"
android:exported="true"
android:launchMode="singleTop"
android:noHistory="true"
android:theme="@style/fullScreenActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
<meta-data
android:name="preloaded_fonts"
android:resource="@array/preloaded_fonts" />
</application>
</manifest>
build.gradle
file:compileSdk
, minSdk
, and targetSdk
.build.gradle.kts
file:plugins {
alias(libs.plugins.android.application)
}
android {
namespace = "com.lazymind.myfirstapp"
compileSdk = 34
defaultConfig {
applicationId = "com.lazymind.myfirstapp"
minSdk = 24
targetSdk = 34
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}
dependencies {
implementation(libs.appcompat)
implementation(libs.material)
implementation(libs.activity)
implementation(libs.constraintlayout)
testImplementation(libs.junit)
androidTestImplementation(libs.ext.junit)
androidTestImplementation(libs.espresso.core)
}
android > defaultConfig
: Sets the app’s default configuration.dependencies
: Contains libraries and frameworks needed by the app.Why do we need dependencies?
This is a comment 1.
This is a comment 2.