How to Solve Gradle Error Cannot Find Symbol

Android Studio: Gradle: error: cannot find symbol variable

You shouldn't be importing android.R. That should be automatically generated and recognized. This question contains a lot of helpful tips if you get some error referring to R after removing the import.

Some basic steps after removing the import, if those errors appear:

  • Clean your build, then rebuild
  • Make sure there are no errors or typos in your XML files
  • Make sure your resource names consist of [a-z0-9.]. Capitals or symbols are not allowed for some reason.
  • Perform a Gradle sync (via Tools > Android > Sync Project with Gradle Files)

Android Gradle: Cannot find symbol Q

I believe the problem is that you're not using the correct buildTools. Try upgrading your build tools to at least Android 10.0 (Q) in the SDK Manager.

Assuming you're using Android Studio, click here

Sample Image

around the top of your screen, and then download at least Android 10.0 (Q) to get what you're looking for.

I do recommend, however, that you upgrade to the latests Android 11.0 (R) if you can instead to get all of the latests features!

How to fix Cannot find symbol error in related subproject while running gradle compileJava

It is missing to set two configurations in order to indicate that common is a library. So add the following configuration and compile, run from root of project.

common build.gradle

bootJar {
enabled = false
}

jar {
enabled = true
}

Gradle (Java) cannot find symbol for class in subdirectory of package

That Manager class have to implement Application.ActivityLifecycleCallbacks like this:

package com.A.B.C; 
public class Manager implements Application.ActivityLifecycleCallbacks{
...
}

Also, I guess you missed the new while calling registerActivityLifecycleCallbacks() :

registerActivityLifecycleCallbacks(new Manager());

cannot find symbol intellij gradle

Looks like when you are importing the project, Gradle wrapper is choosing an incompatible version of Gradle for JDK 10 (See This).

You can try installing gradle manually in your system (preferably any version that is greater than 4.7). Then choose the option "Use local gradle distribution" and specify the gradle installation path in Intellij.

Then you should be fine!



Related Topics



Leave a reply



Submit