Home android Cannot resolve symbol 'R' in AndroidStudio

Cannot resolve symbol ‘R’ in AndroidStudio




I open the project (opensource) to see the implementation. Everything seems to be fine, but swears in R:

protected void onFinishInflate () {
  super.onFinishInflate ();
  mTitle = (TextView) findViewById (R.id.title);
  mAuthor = (TextView) findViewById (R.id.author);
  mPubDate = (TextView) findViewById (R.id.pub_date);

What does this mean and what are the ways to solve this problem?

Answer 1, authority 100%

In AndroidStudio File- & gt; InvalidateCahces . You can also Build- & gt; Clean Project .


If you open a project taken, for example, from GitHub, and change, for example, the package name, then the data on the classpaths that are stored in the cache are correspondingly different. When you clear the cache, the system picks up the changes.

Answer 2, authority 14%

You can also click Sync Project with Gradle files . Helped me.

 Sync Project with Gradle files

Answer 3

This helped me: set the Compile Sdk Version to the latest.
http://dominoc925.blogspot.com/2014/ 11 / fixing-android-studio-cannot-resolve.html

Answer 4

I was helped by changing the compileSdkVersion in the build.gradle for the application, to the version corresponding to compile ‘com.android.support:appcompat-v7:’
I have compileSdkVersion 26, com.android.support:appcompat-v7: 26.1.0
mac os hight sierra android studio 3.1 system

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions