When the android project is compiled, Gradle Sync works normally, but a compilation error is reported, indicating Could not resolve. . .

1. Problem phenomenon:
When compiling the android project, Gradle Sync is normal, but an error is reported during compilation, prompting Could not resolve. . .
insert image description here

2. Solutions
When dealing with the above problems, four solutions were used, and the last method 4 took effect.

method 1:

Recompile:

insert image description here

Clean the project first and then recompile the project.

This method does not take effect for this error.

Method 2:

Clear all resources of the project and reload them.

insert image description here

This method does not take effect for this error.

Method 3:

Upgrade the Gradle plug-in version of the project and the corresponding Gradle version. Note that the Gradle plug-in version and the Gradle version must correspond.

insert image description here

After trying, this method still cannot solve this problem.

Method 4:

Delete the gradle.properties file under the corresponding environment variable.

Windows path: C:\Users\username.gradle

Back up the .gradle folder in this directory and delete it.

Then reload the project.

insert image description here

Guess you like

Origin blog.csdn.net/qq_38696286/article/details/128902111