A standard Android app module lives under app/src/main/. Source code, UI resources, and the manifest are separated so Gradle can compile, package, and optimize each part independently.
AndroidManifest.xml is the app's blueprint. It tells Android the package name, permissions, and every component (Activities, Services, etc.) in your app.
Registers each screen; launcher Activity has MAIN + LAUNCHER intent filter
android:exported
Whether other apps can launch this component (required for Android 12+)
Merged manifest
Libraries (Firebase, Play Services) contribute their own manifest entries. Android Studio merges them into one final manifest at build time — view the result via Build → Analyze APK or the Merged Manifest tab.
2Java/Kotlin Folder
All application logic lives under app/src/main/java/ (or kotlin/ in older templates — modern projects use java/ even for Kotlin files). The folder path mirrors your package name.
The res/ (resources) folder holds all non-code assets that Android compiles into the R class. Each subfolder has a specific resource type.
Subfolder
Contains
Reference in code/XML
drawable/
Images, shapes, vector icons, selectors
@drawable/ic_logo
layout/
XML UI definitions
@layout/activity_main
values/
Strings, colors, dimensions, themes, styles
@string/app_name
mipmap/
Launcher icons (adaptive icons)
@mipmap/ic_launcher
menu/
Options menu and context menu XML
@menu/main_menu
xml/
Preferences, network security config
@xml/network_config
Code references R.drawable.logo or @string/title
Android builds R.java / R.kt with integer IDs
Gradle compiles res/ XML and images at build time
Device locale & density pick best match (values-es, drawable-hdpi)
APK packages compiled resources for runtime
Qualifiers: Folders can include qualifiers like layout-land (landscape), values-night (dark theme), drawable-xxhdpi (high-density screens). Android picks the best match automatically.
4drawable
res/drawable/ stores graphics and XML drawables — bitmaps (PNG, WebP), vector icons (SVG converted to Vector Drawable), shapes, and state selectors.
Common drawable types
Vector Drawable
Scalable XML icons — one file for all screen densities.
Bitmap (PNG/WebP)
Photos and complex images — use WebP for smaller APK size.
Shape Drawable
Rounded corners, borders, solid fills defined in XML.
State List
Different appearance for pressed, focused, disabled states.
Kotlin — Use drawable in code or XML// In layout XML:
// android:background="@drawable/rounded_button"
// In Kotlin:
imageView.setImageResource(R.drawable.ic_logo)
5layout
res/layout/ contains XML files that define UI hierarchies. Each file describes one screen or reusable UI chunk (e.g., a list item).
res/values/ centralizes strings, colors, dimensions, and themes. Externalizing these makes localization, dark mode, and design consistency much easier.
XML — res/values/strings.xml<resources>
<string name="app_name">MyFirstApp</string>
<string name="welcome_message">Welcome to Android!</string>
<string name="button_submit">Submit</string>
</resources>
XML — res/values/colors.xml<resources>
<color name="primary_green">#3DDC84</color>
<color name="dark_background">#061620</color>
<color name="text_primary">#1A2E24</color>
</resources>
Gradle — Common tasks# Sync and build debug APK
./gradlew assembleDebug
# Run all unit tests
./gradlew test
# List project dependencies
./gradlew app:dependencies
8Assets & Resources
Android distinguishes between resources (res/) and raw assets (assets/). Understanding the difference prevents common packaging and access errors.
Kotlin — Read a file from assets/// Read JSON from assets/config/app_settings.json
val json = assets.open("config/app_settings.json")
.bufferedReader()
.use { it.readText() }
Log.d("Assets", json)
Kotlin — Read from res/raw/ (alternative)// res/raw/sample.json → R.raw.sample
val inputStream = resources.openRawResource(R.raw.sample)
val text = inputStream.bufferedReader().use { it.readText() }
Use res/
UI, strings, icons, themes
Use assets/
Custom files, ML models, game data
Use res/raw/
Single raw files needing an R.raw ID
Key takeaway: Use res/ when Android should compile and ID your files; use assets/ when you need raw files with custom folder paths read at runtime.
9Summary Table – Resource Access
Quick reference for how each resource type is stored and accessed in XML layouts vs Kotlin code.
Resource Type
Folder
Access in XML
Access in Kotlin
Layout
res/layout/
@layout/activity_main
R.layout.activity_main
String
res/values/strings.xml
@string/app_name
R.string.app_name
Color
res/values/colors.xml
@color/purple_500
R.color.purple_500
Dimension
res/values/dimens.xml
@dimen/padding_small
R.dimen.padding_small
Image (png)
res/drawable/
@drawable/icon
R.drawable.icon
Vector drawable
res/drawable/
@drawable/ic_heart
R.drawable.ic_heart
Shape drawable
res/drawable/
@drawable/rounded_button
R.drawable.rounded_button
Menu
res/menu/
@menu/main_menu
R.menu.main_menu
Animation
res/anim/
@anim/fade_in
R.anim.fade_in
Raw file
res/raw/
Not in XML
R.raw.data
Asset
assets/
Not in XML
assets.open("file.txt")
10Hands-On Exercises
Apply what you learned about project structure with these practical tasks.
1
Add a custom string to strings.xml and display it in a TextView in activity_main.xml using @string/your_key.
2
Create a shape drawable (rounded rectangle with gradient) in res/drawable/ and set it as the background of a button via android:background="@drawable/your_shape".
3
Add a vector asset in Android Studio: File → New → Vector Asset — choose a Material icon and reference it as @drawable/ic_your_icon.
4
Change the app launcher icon by replacing files in res/mipmap/ folders, or use Image Asset Studio (right-click res → New → Image Asset).
5
Add an asset file (e.g., sample.txt) to assets/, read it in MainActivity with assets.open("sample.txt"), and show its content in a TextView.
6
Increment versionCode and versionName in app/build.gradle.kts, then build a new APK and observe the version change in app settings.
Add ProGuard keep rules in proguard-rules.pro, or test with isMinifyEnabled = false first
VersionCode must be increased
Uploading same version code to Play Store
Increment versionCode in defaultConfig for each release upload
Summary: The manifest declares your app to the system; Kotlin/Java folders hold logic; res/ powers your UI and branding; Gradle scripts orchestrate the build; and assets/ stores raw files accessed at runtime. Use the resource access table as a cheat sheet and complete the exercises to solidify your understanding.
Project Structure MCQ Practice
10 Basic MCQs10 Advanced MCQs
10 Basic Project Structure MCQs
1
AndroidManifest.xml defines?
AGradle dependencies
BApp components and permissions
CImage drawables
DDatabase schema
Explanation: The manifest declares Activities, Services, permissions, and app metadata.
2
Kotlin/Java source typically lives in?
Ares/raw/
Bsrc/main/java or kotlin/
Cassets/
Dgradle/
Explanation: Source files go under src/main/java/ or src/main/kotlin/ mirroring package structure.
3
String resources are stored in?
Ares/values/strings.xml
BAndroidManifest.xml
Cbuild.gradle only
Dassets/text/
Explanation: Default strings live in res/values/strings.xml for localization.
4
Drawable resources folder is?
Ares/drawable/
Bsrc/drawable/
Clib/drawable/
Dmanifest/drawable/
Explanation: PNG, XML vector drawables, and shapes go in res/drawable variants.
5
R.java / R.kt is?
AHand-written config
BAuto-generated resource IDs class
CGradle plugin
DADB script
Explanation: The build generates R linking code to layout, drawable, string resources.
6
Module-level build file is usually?
Asettings.gradle.kts
Bapp/build.gradle.kts
Clocal.properties only
Dproguard.txt
Explanation: The app module's build.gradle.kts configures plugins, SDK versions, dependencies.
7
assets/ folder holds?
ARaw files accessed via AssetManager
BCompiled dex only
CManifest backup
DEmulator images
Explanation: Assets are uncompressed files read at runtime (fonts, JSON, etc.).
8
mipmap/ is typically for?
ALauncher icons
BLayout XML
CSQL databases
DGradle cache
Explanation: Launcher icons use mipmap densities (mdpi, hdpi, xhdpi, etc.).
9
colors.xml contains?
AColor resource definitions
BActivity names
CNetwork URLs
DSigning keys
Explanation: Named colors referenced as @color/primary in layouts and themes.
10
settings.gradle.kts defines?
AWhich modules belong to the project
BApp label
CADB port
DEmulator RAM
Explanation: It includes modules like include(":app").
10 Advanced Project Structure MCQs
11
res/layout-land/ provides?
ALandscape-specific layouts
BGradle scripts
CNight theme only
DDebug APK
Explanation: Qualifier folders supply alternate resources by orientation, size, or API.
12
@+id/button in XML means?
ACreate new ID resource named button
BDelete button
CImport library
DPrivate Java field
Explanation: @+id/ allocates a new ID in R.id during resource linking.
13
Why separate res/values-night/?
ADark theme color/style overrides
BFaster Gradle
CSmaller APK always
DADB config
Explanation: Night qualifiers apply resources when uiMode is night.
14
ProGuard/R8 rules often in?
Aproguard-rules.pro
Bstrings.xml
CAndroidManifest only
Dadb.ini
Explanation: proguard-rules.pro keeps classes from obfuscation/removal in release.
15
src/main/res vs src/androidTest/res?
AMain app vs instrumented test resources
BSame folder
CEmulator only
DDeprecated
Explanation: Test source sets have separate manifests and resources.
16
Gradle cache corruption symptom?
ABizarre sync errors; invalidate caches
BLayout preview only slow
CEmulator black screen always
DR.id always zero
Explanation: File → Invalidate Caches can fix stale Gradle/Android Studio state.
17
Vector drawable advantage?
AScalable single XML asset
BRequires 5 PNG sizes only
CCannot tint
DJava-only
Explanation: VectorDrawable scales without multiple bitmap densities.
18
tools: namespace attributes?
ADesign-time only; stripped at build
BRequired at runtime
CReplace manifest
DEncrypt resources
Explanation: tools:* attributes assist the editor and are not packaged.
19
Product flavors in Gradle create?
AVariant dimensions (free/paid, etc.)
BNew manifest only
CAutomatic Play listing
DEmulator snapshots
Explanation: Flavors combine with build types to form variant matrix.
20
Accessing raw JSON in assets?
Aassets.open("file.json")
BR.raw only always
Cadb pull
DManifest meta-data only
Explanation: Use AssetManager from context.assets to read asset files.
Click an option to select, then check answers.
Project Structure Interview Q&A
15 topic-focused questions for interviews and revision.
1Describe the standard Android project folder layout.easy
Answer: Project root has settings.gradle, build.gradle; app module has src/main/java|kotlin, res/, AndroidManifest.xml, and module build.gradle.kts.
2What is the purpose of AndroidManifest.xml?easy
Answer: Declares package, components, permissions, features, intent filters, and application-level attributes required by the system.