I cannot use class R. in Kotlin

Asked

Viewed 290 times

2

I’m trying to learn Kotlin , but I’m having trouble importing the "R." class into Kotlin. inserir a descrição da imagem aqui

Someone would know what I’m doing wrong ?

  • Build -> rebuild

  • I had an error similar to yours, connected to the internet, and updated the Gradle tasks, double click on the link below the error.

  • This error usually occurs when you have some xml error in your layout

3 answers

1

This happened to me too, I did Build->Clean Project and it worked.

0

You can try going to the Build menu and the Clean Project submenu or Reboot Android Studio. In some cases just reboot back to normal. Android Studio sometimes has these bugs of not recognizing any class.

0

"R" is not a class, but Resources (your application res folder)

Try removing the "R" from com.claudioshigemi.carros.Ctivity.R

  • R is a yes class, and it is generated dynamically when a project build occurs.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.