Ron
Ron

Reputation: 399

Android studio not found R.id.****

It has worked fine till now, but I apparently touched something and something happened.
Android Studio did not found R.id.**** and R.layout.****.

https://i.sstatic.net/EVZun.png

What do I need to do to resolve the problem?

Upvotes: 6

Views: 9650

Answers (6)

You may import android.R at the top of your activity and use it in a command. Clear this import and use android.R.*** in that command and you can see R.layout.*** and R.id.*** in other commands can work.

Upvotes: 0

qqqwerqqq
qqqwerqqq

Reputation: 71

check build.gradle(app). if there is not apply plugin: 'kotlin-android-extensions' on top of page include it. That works for me.

or type id 'kotlin-android-extensions' instead.

Upvotes: 2

Powkachu
Powkachu

Reputation: 2268

I got the same error and just found out I imported automatically android.R. I just had to remove it.

Check if you have import android.R at the top of your file.

Upvotes: 17

iMDroid
iMDroid

Reputation: 2128

I Think Your R.java is not getting build properly due to some error. Clean your project and Check if there is some error while rebuilding the project.

Upvotes: 0

Zerp
Zerp

Reputation: 892

resync gradle, it will solve this.

enter image description here

Upvotes: 0

user4323984
user4323984

Reputation:

Try to undo(ctrl+z) whatever you did accidentally or go to build-> rebuild project. or build-> clean project or press ctrl+alt+y.

Upvotes: 0

Related Questions