armnotstrong
armnotstrong

Reputation: 9065

how to make this `R` happy in android project?

Really newbie to Android project, but just want to run a demo project from here

After import to the new Gradle style, found that some code like builder.setIcon(R.drawable.ic_dialog_alert); R can't find the dependency,

And I checked other project's which R is happy, but did not find any dependency imported explicitly.

And the magic Alt+Enter is not working this time either :-(

This may be a silly question, but please give some guidance.

enter image description here

Upvotes: 0

Views: 59

Answers (3)

Akshay Katariya
Akshay Katariya

Reputation: 1474

Try the following steps:-

1) Check if you have imported 'R' or not, if not import it by clicking "Alt+Enter" in windows/linux.

2) Clean & rebuild your project and then try to run it.

I think this will definitely solve your problem.

Upvotes: 0

Vishal Vaishnav
Vishal Vaishnav

Reputation: 3422

Clean and Rebuild your Project.

It will rebuild your R file for your specific project and don't import R from Any other package only import from "'your.package.name'.R".

Upvotes: 1

Vishnu Prasad
Vishnu Prasad

Reputation: 566

Check Which R file you have imported in this class , you should import R file of your package.

Upvotes: 1

Related Questions