Parmjeet Saharan
Parmjeet Saharan

Reputation: 11

can not resolve R

Initially Android Studio shows 'can not resolve ...' but after I clean and rebuild the project it can not resolve R.

enter image description here

enter image description here

enter image description here

Upvotes: 0

Views: 185

Answers (2)

ישו אוהב אותך
ישו אוהב אותך

Reputation: 29794

If you read the error throughly, you will found the following:

error:resource drawable/ic_launcher(aka com.example.paramjeet.service:/drawable/ic_launcher) not found

That means you don't have any image named ic_launcher in res/drawable/ or res/drawable***/

You only have ic_launcher in /res/mipmap/. So, change to it.

Upvotes: 0

Bill
Bill

Reputation: 400

Gradle build finished with 7 error(s) in 12s 393ms (2 minutes ago)

This means that your app failed to build. The way Android Studio works is that the R class is generated as part of the build - it was deleted when you cleaned the project, and since the build failed it could not be recreated.

This is a red herring error - it's an actual build error, but it's caused by another. If you open the Messages tab, you'll see a few errors - the Unresolved reference: R ones will be there, but so will be others. If you manage to fix them, them the R ones will fix themselves. :)

Upvotes: 1

Related Questions