cannot resolve symbol r android studio

Открываю проект (opensource) посмотреть реализацию. Все вроде нормально, но ругается на R:

Что это означает и какие есть способы решения этой проблемы?

4 ответа 4

В AndroidStudio File->InvalidateCahces . Можно еще Build->Clean Project .


Если вы открываете проект взятый, например, из GitHub, и меняете, например, имя пакета, то данные о путях к классам которые хранятся в кэше соответственно другие. Когда вы очищаете кеш, система подхватывает изменения.

Andro >

При сознании новых прогектов в Android Studio начал получать ошибку «Сannot resolve symbol «R»«.

Проблема возникает из-за «недоработки» в библиотеке совместимости «appcompat». Решение простое. Необходимо изменить текущую версию библиотеки на стабильную, например на «» (по состоянию на 2017.01.05).

Как это сделать? Идем в структуру проекта «File->Project Structure».

В открывшемся окне, в левой части формы, выбираем «app» и переходим на вкладку «Dependensies».

Not only you, but many programmers are also facing a “cannot resolve symbol r” error in Android app development. An “r” turns red and can’t run the Application and throw the error in logcat. This problem has faced mostly the time when you shift your code another Computer or send the code to another person.

Where the letter R stands for the Resource. This error occurs because of the incapability of the build process to Sync Resource files with your projects. Usually this happens because of the improper build of the project.


There are many ways to remove error “cannot resolve symbol r“, Here are some:-

  • XML File – there is a problem with your XML.
  • Gradle Files – Not proper sync or different version.
  • Caching – Inval >Lowered compileSdkVersion and targetSdkVersion
  • OLD Andro >

Let’s Solve the Error – “cannot resolve symbol r”

We will look a solution for it one by one with a step. Chances are any one of them will solve it.

XML File

If your resource file XML file even minor miscoded then you will face this problem. Check your resource layout and other XML. Android Studio turns this file into red color. Then check file and code of it where is the problem.

The Gradle Files Sync

Try the sync Gradle, may this solve the “cannot resolve symbol android studio“. Follow this step:-

  • Toolbar -> File -> Sync project with gradle

  • OR direct click on the icon -> Sync project with gradle

Note: A Screenshot is from Mac OS, so there is chances position of button and icon change in Linux, Windows, and another os.

Still not working check the Gradle Version and update to latest one.


It can be a problem of “cannot resolve symbol r android studio“, let try this also.

    File -> Inval >

Package name

This is a very common mistake done by a developer a changing a package name in manifest or change class location package. Let’s see what if I change if the package in the AndroidManifest.xml.

Changing -> com.eyehunts.myapplication to com.eyehunts.a.myapplication

Output and code structures:


A lower or upgrade version of any library can make genrate this error. To prevent r error in android, check Module Grable and your project SDK and target version.

OLD Android Studio

Recently I face this cannot resolve symbol r issue, I tried all ways which mentioned in this tutorial. In the last, I did update my Android studio and the problem was solved.

You can check your Android studio version and update it:-

  • Click -> Android Studio -> Check for updates …
  • If update available -> Click -> Update & restart.
  • If delete old version option came after installation new patch, then do delete all. It’s just taking space in your computer hard disk.

Clean and Rebuild Project

Last but can be first option to do solve error –cannot resolve symbol r.

Almost every one suggest this process. It may work if there is no package, version, gradle version, SDK version etc problem.

Let’s see step to do it:-

  • Click on Build -> Clean project

  • Click on “Build” and click on “Rebuild Project”

If still facing the issue – “How to solve cannot resolve symbol r in the Android Studio“, then comment in below. And any other solution you have, then comment. We will update in this tutorial.

Note: This example (Project) is developed in Android Studio 3.3.2. Tested on Android 9 ( Android-P), compile SDK version API 28: Android 9.0 (Pie)

Coding in Java and kotlin

Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.

Оцените статью