Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove Kotlin support from an Android project?

How to remove kotlin support from a new project and work with only java support without creating a new project ?

like image 779
Omar El Fellah Avatar asked Sep 08 '18 01:09

Omar El Fellah


1 Answers

Step 1: Delete or comment-out these lines from build.gradle (Project) file.

ext.kotlin_version = '1.1.51' // My kotlin_version might be different from yours.
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

Step 2: Delete or comment-out these lines from build.grale (Module) file

apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"

Step 3: Then hit Sync Now.

Note: Whenever you navigate to kotlin classes, you will see a popup always display on their header and the code is still highlighted.

enter image description here

To remove this popup and do not highlight kotlin code, go to File -> Settings to disable Kotlin plugin.

enter image description here

Then hit on Apply -> OK, after that a dialog will display to notify you reset Android Studio, just hit reset. Next time you open the project, the popup is gone and kotlin code is not highlighted anymore. It just like a normal file in your project.

enter image description here

like image 73
Son Truong Avatar answered Sep 21 '22 18:09

Son Truong