
上QQ阅读APP看书,第一时间看更新
How to do it...
Creating a project in Android Studio is very simple and to create it in Kotlin just requires one extra click. Here's a step-by-step process of doing it:
- In Android Studio, in the menu, click on File | New | New Project. Alternatively, if you've just opened Android Studio and see the Welcome to Android Studio window, click on Start a new Android Studio project.
- In the wizard, add your Application name and Company domain, and simply check the box that says Include Kotlin support. Click on Next:

- On the next screen, you will be asked to choose your target devices and the minimum SDK support. So basically, it asks things like, "Do you want the application to run on both phone and android wear?" and "Do you want to support from Jelly Bean up or KitKat and up?":

- On the next screen, you will be prompted to Add an Activity to the project. You can also skip this step and add an activity later, but for now, just click on a Basic Activity and click on Next. If you have also chosen Wear or any other option, you will be prompted to add activity for those components as well:

- Next, you will be prompted to Configure the Activity you added. Basically, what you have to do is to provide Activity Name, Layout Name, and Title. After this, click on Finish, because you are done with creating your first project in Kotlin.
- Run project on your device: You need to follow these steps:
- Connect your device to your development machine with a USB cable.
- Enable USB debugging on your device by going to Settings | Developer options.
On Android 4.2 and newer, Developer options are hidden by default. To make it available, go to Settings | About phone and tap on Build number seven times. Return to the previous screen to find Developer options.
Now in your Android Studio, click on the app module in the Project window and then select Run (or click on Run in the toolbar).
In the Select Deployment Target window, select your device, and click on OK. After a while, you will see the application running on your mobile or an emulator.