Android Studio导入项目后无法解析方法。

huangapple go评论55阅读模式
英文:

Android Studio cannot resolve method after Importing a Project

问题

我是Android Studio环境中的新手。我的IDE版本是Android Studio Electric Eel | 2022.1.1 Patch 1。我一直无法解决这个问题。最近,我被分配到一个已经开发好的Android Studio项目。因此,我从git上下载了它。但在打开它后,Android Studio显示了大量相同类型的错误。
IDE无法解析其他类的函数或变量,这些函数或变量与get和set函数一起使用。
更令我困惑的是,当我运行'app'时,它可以成功构建和运行。

提前感谢。

我已经使缓存无效,重新启动了IDE,丢弃了整个项目,然后再次从git上下载。但这些错误还是没有消失。

英文:

I am new in Android Studio environment. My IDE Version is Android Studio Electric Eel | 2022.1.1 Patch 1. I have been unable to fix this issue for quite some time. I was recently assigned to an already developed Android Studio Project. So, I downloaded it from the git. But after opening it, Android Studio is showing me loads of errors of same type.
The IDE cannot resolve other class's functions or variables which are used with get and set function.
What is even more confusing to me, when I run the 'app' it builds and runs successfully.

Thanks in advance.

I have Invalidated Caches, Restarted IDE, discarded the whole project and again downloaded from git. But these errors are not going away.

答案1

得分: 0

我遇到了这个问题。
不要担心。问题实际上是Lombok插件。Android Studio的最新版本不支持它。
以下是您需要做的:

  1. 转到以下网址:https://plugins.jetbrains.com/plugin/6317-lombok/versions
  2. 查看最新版本并下载。
  3. 将其解压缩到您的下载目录中。
  4. 然后复制包含“lombok-plugin”文件夹并粘贴到Android Studio/plugins目录中。
  5. 使缓存无效(可选)。
  6. 重新启动IDE。

希望有所帮助。

英文:

I have faced this problem.
Do not worry. The problem is actually the Lombok Plugin. Android Studio's latest versions do not support it natively.
Here is what you need to do:

  1. Go to this URL:
    https://plugins.jetbrains.com/plugin/6317-lombok/versions
  2. Check out the latest version and download.
  3. Unzip it in your Downloaded Directory.
  4. Then copy the containing "lombok-plugin" folder and paste it to
    Android Studio/plugins directory.
  5. Invalidate Cache (Optional)
  6. Restart IDE

Hope it helps.

huangapple
  • 本文由 发表于 2023年3月15日 18:00:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/75743123.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定