Book Image

Mastering Android Development with Kotlin

By : Miloš Vasić
Book Image

Mastering Android Development with Kotlin

By: Miloš Vasić

Overview of this book

Kotlin is a programming language intended to be a better Java, and it's designed to be usable and readable across large teams with different levels of knowledge. As a language, it helps developers build amazing Android applications in an easy and effective way. This book begins by giving you a strong grasp of Kotlin's features in the context of Android development and its APIs. Moving on, you'll take steps towards building stunning applications for Android. The book will show you how to set up the environment, and the difficulty level will grow steadily with the applications covered in the upcoming chapters. Later on, the book will introduce you to the Android Studio IDE, which plays an integral role in Android development. We'll use Kotlin's basic programming concepts such as functions, lambdas, properties, object-oriented code, safety aspects, type parameterization, testing, and concurrency, which will guide you through writing Kotlin code in production. We'll also show you how to integrate Kotlin into any existing Android project.
Table of Contents (24 chapters)
Title Page
Credits
About the Author
Acknowledgments
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Initializing a Git repository


We have installed Android Studio and introduced ourselves to some important SDK tools. We also learned how to deal with emulated devices that will run our code. It is time to start working on our project. We will develop a small application for notes and todos. This is a tool that everybody needs. We will give it a name--Journaler and it will be an application capable of creating notes and todos with reminders that will be synced to our backend.

First step in development is initializing a Git repository. Git will be our code versioning system. It is up to you to decide if you will use GitHub, BitBucket, or something else for a remote Git instance. Create your remote repository and keep its URL ready, along with your credentials. So, let's start!

Go into the directory containing the project:

Execute: git init .

The console output will be something like this:

Initialized empty Git repository in <directory_you_choose/.git>

We initialized the repo.

Let's add the first file--vi notes.txt.

Populate notes.txt with some content and save it.

Execute git add . to add all of the relevant files.

  • Then: git commit -m "Journaler: First commit"

The console output will be something like this:

[master (root-commit) 5e98ea4]  Journaler: First commit1 file changed, 1 insertion(+)create mode 100644 notes.txt

As you remember, you prepared your remote Git repository url with credentials. Copy url into a clipboard. Now, execute the following:

git remote add origin <repository_url>

This sets the new remote.

  • Then: git remote -v

This verifies the new remote URL.

  • Finally, push everything we have to remote: git push -u origin master

If you are asked for credentials, enter it and confirm by pressing Enter.