Home > Mobile >  Android Mixing Java and Kotlin , can't find Kotlin files
Android Mixing Java and Kotlin , can't find Kotlin files

Time:09-26

I've an existing Java project, I am trying to add a Kotlin activity but it's not listed in java files in android studio.

Inputs: kotlin files are added to main folder like this:

enter image description here

Gradle project is updated like this:

        classpath 'com.android.tools.build:gradle:4.2.2'
    classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0'

Gradle app level is updated like this:

    apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

finally in android studio, can't find Kotlin activity. only java files are listed.

enter image description here

did I miss any configuration?

CodePudding user response:

Don't need to add another package in this case, just add another activity with Kotlin language like this (source language should be Kotlin):

enter image description here

  • Related