This is a Weather App built using Jetpack Compose, Kotlin, and Android Studio. The app provides current weather information for a specified city.
- Display current temperature with a degree icon
- Show error messages using Snackbar for network issues and invalid city names
- Android Studio Ladybug | 2024.2.1 Patch 3
- Kotlin 1.8.0 or higher
- Gradle 7.0 or higher
git clone https://github.com/rishirajput/Weather-Android-App cd weather-appTo provide the Weather API key, you have the following options:
-
Via Android Studio Settings:
- Go to
Android Studio -> Settings -> Build, Execution, Deployment -> Gradle-Android-Compiler - Enter the following in the command line options:
-PweatherApiKey=YOUR_API_KEY
- Go to
-
Via
local.propertiesFile:- Open
local.propertiesfile in the root of your project and add the following line:
weatherApiKey=YOUR_API_KEY - Open
-
Via Command Line:
- Pass the API key as a command line option when building or running the project:
./gradlew assembleDebug -PweatherApiKey=YOUR_API_KEY
- Open the project in Android Studio.
- Sync the project with Gradle files.
- Build and run the project on an emulator or physical device.
This project follows Clean Architecture principles with MVVM (Model-View-ViewModel) pattern to ensure clean, modular, and testable code. The architecture is divided into three main layers:
- Presentation Layer: Contains UI components and ViewModels.
- Domain Layer: Contains business logic and use cases.
- Data Layer: Contains data sources and repositories.
- ViewModel: Manages UI-related data and handles user interactions.
- Composable Functions: Define the UI components using Jetpack Compose.
- Use Cases: Encapsulate business logic and interact with repositories.
- Entities: Represent core business objects.
- Repositories: Provide data from various sources (e.g., network, database).
- Data Sources: Handle data operations (e.g., API calls, database queries).
Here is an example of how the layers interact:
- ViewModel: Fetches weather data using a use case and exposes it to the UI.
- Use Case: Retrieves weather data from the repository.
- Repository: Fetches weather data from a remote data source (e.g., API).
This project uses Koin for dependency injection.
To run unit tests, use the following command:
./gradlew testDebugUnitTestTo run UI tests, use the following command:
./gradlew connectedAndroidTestThis project is licensed under the MIT License. See the LICENSE file for more details.


