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

留言

熱門文章

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

如何創造出難以維護的程式碼

雲端硬碟比較,哪種硬碟最推薦? (Google 雲端硬碟, OneDrive, DropBox, iCloud)