Setting up Anko with Gradle
We will begin by setting up the Anko library in our project. We will be using Gradle to handle the dependencies of the project.
Getting ready
I'll be using Android Studio to write code. You can also find the source code in the 1-setting-up-anko-with-gradle
branch of repository at https://gitlab.com/aanandshekharroy/Anko-examples.
How to do it…
Follow these steps to add Anko to your project using the Gradle build system:
- The easiest way to set up Anko with Gradle is do it by adding the following lines in your
build.gradle
file:
compile "org.jetbrains.anko:anko:$anko_version"
- You can replace
$anko_version
with the latest version of Anko, which is 0.10.1 when this book was written. - The preceding compile statement will add all available features (including Commons, Layouts, SQLite) into your project at once. If you don't want that, and would prefer adding them separately as needed, here are the compile statements:
anko-commons
: This library contains a lot of helpers for...