Android Studio does not update to the latest version using Kotlin

Source: Internet
Author: User

First step: Install the Kotlin plugin

Open the Settings panel, find the Plugins option, click Browse Repositories (browse the warehouse), enter "Kotlin" to find it, and then install it. You will need to restart Android Studio after the installation is complete.

After the installation is complete, as shown in.

Step Two: Configure the Kotlin development environment

Click the Tools option in the menu bar, select Kotlin, and then select Configure Kotlin in Project. As shown in.

In the pop-up window, select the module that needs to use Kotlin and the version of the Kotlin compiler and runtime , as shown in.

After clicking "OK", the Kotlin plugin will start the configuration automatically. Once the configuration is complete, synchronize the project (Sync Project).

In fact, the so-called configuration is changed in the configuration file

First look at the changes in the app's Build.gradle

And look at the total build.gradle.

After configuring the environment, you can convert mainactivity to Kotlin to see the difference between a button's click events before and after the conversion

After conversion before conversion

Convert Java to Kotlin

You can ctrl+alt+shift+k directly in the class that you want to convert, or you can

These operations are completed and then run directly.

Android Studio does not update to the latest version using Kotlin

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.