Android Studio的Java(生成的)文件在运行应用程序时出现错误

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

Android Studio Java (generated) files are posing errors while running the app

问题

我刚刚在我的Android Studio中导入了一个项目。当我尝试重构软件包名称时,开始出现错误。我是Android方面的初学者,只需要您的帮助。
当我通过重命名java后面的第一个文件夹来重构软件包名称时,它确实更改了文件夹名称,但是在java(生成的)文件中有一些导入。现在我无法优化生成的文件中的导入,因为它们不能被更改,所有更改都会丢失。

Android Studio的Java(生成的)文件在运行应用程序时出现错误

英文:

I just imported a project in my Android Studio. When I tried to refactor the package name, I started facing errors. I am a beginner in Android so just need your help.
When I refactored the package name by renaming the first folder after java. It did change the folder name but there were some imports in files of java (generated). Now I am unable to optimize imports in the generated files as it cannot be changed and all the changes are lost.

Android Studio的Java(生成的)文件在运行应用程序时出现错误

答案1

得分: 1

你在java(生成的)文件夹下...

那些java文件不应该被编辑...

那些是由编译器生成的....

明确写着不应该被编辑

正如你所说,“我正在尝试重构包名”,只需参考这个链接

谢谢

英文:

you are under java (generated) folder ...

those java files should not be edited...

those are generated by compiler....

it is clearly written above it should not be edited

as you said I am trying to refactor the package name just refer this this

Thanks

答案2

得分: -1

Android Studio IDE文件菜单 -> 无效缓存并重新启动 -> 无效缓存并重新启动。

这应该可以解决您的错误。

英文:

from Android Studio IDE file menu -> Invalidate Cache and restart -> Invalidate Cache and restart.

this should solve your errors

答案3

得分: -1

如果您计划更改包的名称,请尝试这个答案。编辑生成的文件的目的是什么?

英文:

If you are planning to change the name of the package try this answer. what is the purpose to edit a generated file

huangapple
  • 本文由 发表于 2020年9月29日 19:38:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/64118841.html
匿名

发表评论

匿名网友

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

确定