3.5. Kotlin Android environment building

发布时间 : 2025-10-25 13:34:26 UTC      

Page Views: 10 views

3.5.1. Install the Kotlin plug-in #

Android Studio will be installed built-in starting with version 3.0 (preview) Kotlin plug-in.

Open Settings (Mac is Preferences) panel, found on the right Plugins option (command+ under the shortcut key Ctrl+, Mac), enter “Kotlin” in the search box, click Search in repositories (search in warehouse), and then install it. After the installation is completed, you need to restart Android Studio .

Image0

Image1

3.5.2. Create a new project #

Choice Start a new Android Studio project or File|New project, mostoptions have default values, you only need to press the”enter” key a fewtimes.

Image2

Android Studio 3.0 provides the option to enable Kotlin support in the current dialog box. When checked, you can skip the “configure Kotlin Project (Configuring Kotlin in the project)” step.

Select the Android version:

Image3

Select what you need to create Activity style:

Image4

Name the Activity :

Image5

In Android Studio 3.0, you can choose to use the Kotlin create activity so the “convert Java code to Kotlin (Converting Java code to Kotlin)” step is not required.

In previous versions, Java was used to create the activity and then convert using the automatic conversion tool.

3.5.3. Convert Java code to Kotlin #

Reopen Android Studio, create a new Android project, and add a default MainActivity

Open MainActivity.java file, call up Code|Convert Java File to Kotlin File through the menu bar:

Image6

After the conversion is complete, you can see the use of the Kotlin written by activity .

Image7

3.5.4. Configure Kotlin in the project #

When you start editing this file, Android Studio will prompt you that the current project has not been configured Kotlin follow the prompts to complete the operation, or you can select Tools

Image8

When selecting the configuration, there is the following dialog box to select the latest installed version.

Image9

After the configuration Kotlin is complete, the application’s build.gradle file will be updated. You can see the addition of applyplugin: ‘kotlin-android’ and its dependencies.

Image10

To synchronize the project, click “Sync Now” in the prompt box or use the Sync Project with Gradle Files orders.

Image11

《地理信息系统原理、技术与方法》  97

最近几年来,地理信息系统无论是在理论上还是应用上都处在一个飞速发展的阶段。 GIS被应用于多个领域的建模和决策支持,如城市管理、区划、环境整治等等,地理信息成为信息时代重要的组成部分之一; “数字地球”概念的提出,更进一步推动了作为其技术支撑的GIS的发展。 与此同时,一些学者致力于相关的理论研究,如空间感知、空间数据误差、空间关系的形式化等等。 这恰好说明了地理信息系统作为应用技术和学科的两个方面,并且这两个方面构成了相互促进的发展过程。