DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. Introduction to Android App Development With Kotlin: Android Studio, New Project, and AVD

Introduction to Android App Development With Kotlin: Android Studio, New Project, and AVD

Begin your Android app development journey with Kotlin.

Łukasz Mądrzak user avatar by
Łukasz Mądrzak
CORE ·
Feb. 04, 19 · Tutorial
Like (8)
Save
Tweet
Share
10.53K Views

Join the DZone community and get the full member experience.

Join For Free

If you’re reading this, I speculate that you are interested in Android app development. This tutorial is the first in the series of tutorials where we’ll go through the basics of Android development. I’m a firm believer that the best way to learn is by doing. So each tutorial will have a list of steps you are expected to follow. If you do, you’ll end up with a working app that can be a backbone of a bigger project. We’ll use the latest version of Kotlin and Android's newest architecture components. We’ll learn about Room, LiveData, and much more.

If you have done Android development in the past, these tutorials are probably not for you. You should read on if:

  • You would like to dive into the wonderful and prosperous world of app development
  • You would like to learn the basics of Android app development
  • You actually want to make an app rather than just read about making one

Lesson 1

You’re still here… Well then, welcome aboard.

In the first lesson, we’ll get your machine ready for development, install Android Studio, set up a new project, and set up an AVD (you’ll find out what that is shortly).

Let’s begin by getting Android Studio installed on your machine. If you already have it installed, make sure to update it to the latest version. Here’s the link.

The first time you run Android Studio, you’ll have to configure it.

Android Welcome Screen

Select Next, Choose Standard installation type, Select Next again. Select your UI Theme. As you can see above, I’m a big fan of the dark or else “Darcula” mode as opposed to the Light mode. As a developer, you’ll spend a major part of your life staring at the screen and the dark mode is much easier on the eye. Therefore, I would implore you to also opt-in for the dark mode and show your eye-sight some appreciation. Excuse the digression.

Next up is SDK components setup. Make sure to tick Android Virtual Device component and press Next one last time.

Android Studio will now download all the required components, so it may take a while, depending on your bandwidth.

Once ready, Android Studio will launch and you’ll be presented the following screen, which means we’re open for business.

Android Studio Startup screen

Start a new Android Studio project, select Empty Activity, and press Next.

Give your project a name, ensure Kotlin is selected as the language, and make sure to tick AndroidX artifacts i.e.

Image title

Press finish and your Hello World app is ready! But how do we run it?

Now you have two options. You can either run the app on a physical device (assuming it runs Android 5.1 or higher) or you can set up an AVD on your machine. AVD is an Android Virtual Device, which is an emulated Android device running on your machine. It’s great because that means you can test your app on different versions of Android with different screen sizes. You can even emulate a tablet!

If you’d like to use your physical phone, you’ll need to enable Developer mode on it. You can easily find how to do it if you google it.

I’ll show you how to set up an AVD, and then, we’ll run the app, and this will conclude our first lesson.

Let’s open the AVD manager by clicking Tools > AVD Manager. Then, click on Create Virtual Device button. You’ll see the prompt to select the “hardware” you’d like

Select Hardware screen

I usually choose the Nexus device as it is Play Store compatible and fits in nicely on my MacBook Pro screen. Then, finally, select the version of Android you’d like — I suggest you go with the latest and the greatest, i.e. Android Pie API Level 28. Press Next, give your device a name, and select Finish.

Now, we are ready to run our super sophisticated app!

Under the Run menu, choose ‘Run app.' You’ll be asked to Select Deployment Target. That’s your newly created AVD. For convenience, make sure to tick ‘Use same selection for future launches.’

Select Deployment Target Screen

Now, your AVD should launch, and hopefully, you’ll see a glowing ‘Hello world’ from Android!

Image title

Note: If your app crashes on the first run, it’s possibly caused by the old version of Constrain Layout — in which case you must go to your build.gradle (Module:app) file and replace

implementation 'androidx.constraintlayout:constraintlayout:1.1.2'

with

implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

Conclusion

In the first part of the series, we got your development machine setup and ready to get you started on a journey to Android mastery. Or at least some level of adequacy. In the next lesson, we’ll cover some basic theories, including activities, fragments, and activity life cycle.

Android (robot) app Android Studio Kotlin (programming language)

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Top Three Docker Alternatives To Consider
  • AWS Cloud Migration: Best Practices and Pitfalls to Avoid
  • How to Secure Your CI/CD Pipeline
  • Upgrade Guide To Spring Data Elasticsearch 5.0

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: