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

留言

熱門文章

解決選擇 Active Build Variant -> Release 執行錯誤

svn 刪除使者資訊 & 查看使用者帳號密碼