Android Tutorial
Software Setup and Configuration
Android Studio
File Structure
Components
Core Topics
Layout
View
Button
Intent and Intent Filters
Toast
RecyclerView
Fragments
Adapters
Other UI Component
Image Loading Libraries
Date and Time
Material Design
Bars
Working with Google Maps
Chart
Animation
Database
Advance Android
Jetpack
Architecture
App Publish
App Monetization
When you create a new Android project using Android Studio, it sets up a standard project structure for you. Here's an overview of the typical folder structure:
app/
manifests/
java/
res/: Contains resources used in the app.
Gradle Scripts/: Contains the build scripts.
.gradle/ and .idea/:
build/:
libs/:
.gitignore:
This structure helps in organizing resources and source files, making it easier for developers to navigate and maintain the project. As your project grows, you might introduce new directories or files, but the basic structure will remain similar.
Android project directory layout:
An Android project typically has the following directory layout:
app/ ������ src/ �� ������ main/ �� �� ������ java/ // Java or Kotlin source code �� �� ������ res/ // Resources (layouts, drawables, etc.) �� �� ������ AndroidManifest.xml �� ������ test/ // Unit tests ������ build.gradle // Module-level build script
Recommended folder structure for Android projects:
Follow a modular structure:
app/ ������ src/ �� ������ main/ �� �� ������ java/ �� �� �� ������ com/ �� �� �� ������ example/ �� �� �� ������ myapp/ �� �� �� ������ feature1/ �� �� ������ res/ �� �� ������ AndroidManifest.xml �� ������ test/ ������ build.gradle
Group features into separate packages/modules.
How to organize packages in Android project:
Organize packages by feature:
com.example.myapp ������ feature1/ �� ������ ui/ �� ������ data/ �� ������ ... ������ feature2/ �� ������ ui/ �� ������ data/ �� ������ ... ������ ...
Divide packages into UI, data, and other logical segments.
Standard Android project directory conventions:
Stick to the standard Android directory conventions:
app/ ������ src/ �� ������ main/ �� �� ������ java/ �� �� ������ res/ �� �� ������ AndroidManifest.xml �� ������ test/ ������ build.gradle
Adhering to conventions ensures compatibility with Android build tools.
Gradle project structure for Android apps:
The Gradle project structure is defined in build.gradle
files. The main project's build.gradle
may include module-level build.gradle
files.
myapp/ ������ build.gradle // Main project build script ������ settings.gradle ������ app/ ������ build.gradle // Module-level build script ������ ...
Android app module structure:
Organize the app module by features:
app/ ������ src/ �� ������ main/ �� �� ������ java/ �� �� ������ res/ �� �� ������ AndroidManifest.xml �� ������ test/ ������ build.gradle
Separating resources in Android project:
Segregate resources by type:
app/ ������ src/ �� ������ main/ �� �� ������ java/ �� �� ������ res/ �� �� �� ������ drawable/ �� �� �� ������ layout/ �� �� �� ������ ... �� �� ������ AndroidManifest.xml �� ������ test/ ������ build.gradle
Keep drawables in res/drawable/
and layouts in res/layout/
.