简体   繁体   English

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

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

I just imported a project in my Android Studio.我刚刚在我的 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.我是 Android 的初学者,所以只需要你的帮助。 When I refactored the package name by renaming the first folder after java.当我通过重命名 java.util 之后的第一个文件夹来重构包名称时。 It did change the folder name but there were some imports in files of java (generated).它确实更改了文件夹名称,但在 java 文件(生成)中有一些导入。 Now I am unable to optimize imports in the generated files as it cannot be changed and all the changes are lost.现在我无法优化生成文件中的导入,因为它无法更改并且所有更改都丢失了。

错误截图

you are under java (generated) folder ...你在java(生成的)文件夹下......

those java files should not be edited...那些java文件不应该被编辑...

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正如你所说, I am trying to refactor the package name ,请参考这个

Thanks谢谢

from Android Studio IDE file menu -> Invalidate Cache and restart -> Invalidate Cache and restart.Android Studio IDE文件菜单 -> 使缓存无效并重新启动 -> 使缓存无效并重新启动。

this should solve your errors这应该可以解决您的错误

If you are planning to change the name of the package try this answer .如果您打算更改包的名称,请尝试此答案 what is the purpose to edit a generated file编辑生成的文件的目的是什么

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM