Android Studio 舊 Java 專案加入 kotlin support

1. Check android studio version


2. Check Preferences plugins Kotlin installed


3. Go to https://kotlinlang.org/docs/releases.html, check release details



4. Open Android Studio Project


5. Update build.gradle(project:專案名稱)



6. Add

ext.kotlin_version = '1.4.31' (此處數字為 Release details 版本)

classpath "org.jetbrains.kotlin:kotlin-gradle-plugon:$kotlin_version" ($為前一行定義的版號)


7. Update build.gradle(module)


8. dependencies add

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"


9. Add plugin

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'


10. Sync Now 


11. Wait download ...


Done

留言

熱門文章

2021申請 Android Developer 開發者帳號及上架步驟

Generate Signed Bundle / APK(s) & Bundle Tool 基本使用 & .aab安裝方式

40 個可以改變寫程式技巧的秘訣