Search code examples
javaandroidkotlinandroid-intentandroid-activity

java in class.java in defining a new Intent does not recognize


I am writing an android program with kotlin. I have a problem when I want to define new intent, java in class.java does not recognize

val intent = Intent(this,NormalBtActivity::class.java)
startActivity(intent)

Solution

  • After searching a lot, I found that I have to add this line in my gradle file:

    dependencies {
        implementation("org.jetbrains.kotlin:kotlin-reflect:1.5.21")
    }
    

    and the problem solved