This app is a sample Android app that integrates with the News API. It has low complexity but uses (or tries to use) some good Android development practices.
This app is using an MVVM approach, and it uses the following main libraries:
- Retrofit (REST API requests)
- Gson (for Json serialization/deserialization)
- coil (image loading)
- Result (for a railway oriented response handling)
- Koin (for Dependency Injection)
- ViewModel and LiveData (for ViewModel layer)
- MockK (for mocking / testing)
The dependency management organization is made using Kotlin and the buildSrc
approach, inspired by this article.
This allows better logical organization of dependencies and versions, and enables autocomplete and easy lookup (i.e.: using Ctrl+Click
).
The main downside is that Android Studio no longer warns you when new versions of your dependencies is available, but this feature is added back by using this gradle-versions-plugin.
The plugin adds the dependencyUpdates
gradle task, that generates a report with useful information about you dependencies versions.
To run the project, you will need to get an API Key from News API.
Then you need to create a file called newsapi.properties
at the root location of this project, with the following content:
NEWS_API_KEY="<your_key_here>"
That's it. You should be able to properly run this project.