how to remove generatedJava from android studio 3.2

依然范特西╮ 提交于 2019-12-21 07:23:19

问题


Android studio 3.2

I have migrated my project to android studio 3.2. After migration I see generatedJava folder in my Android folder structure. I don't have any use of it.

How can I remove this generatedJava folder from Android Studio?


回答1:


Why you want to remove this?

Here is some explanation behind the reason to keep it as it is.

No one forces you to look into this folder. But if your project has a lot of generated code (room, data binding, dagger) then it is very handy to have quick access to these files in order to check if they were generated properly, set some breakpoints for debugging etc...

I really do not see anything bad about this folder being visible. In addition if its in the "generated" folder, then everyone could understand the contents are dynamic.

In addition it is good even for beginners to see that their code causes some generated code also. They will understand faster that it is not black magic happening behind room, dagger, data binding etc by seeing what is the actual code generated for a short annotation.




回答2:


You can't actually remove it since it has been in your project also before:

build/generated/source/r/<current flavor>/<current build type>/
  • Refer to this answer.

But now, it reappear in the Android view mode of the project so that we can use for our purposes. There has been many topics like this before and unfortunately I couldn't find anything related to remove or hiding this in the Android Studio.

You also, if you remove it, it will reappear again since it is auto-generated by Android Studio so, perhaps this is gonna be a feature request for the next releases of Android Studio IDE itself.

Also, as mentioned, it can be helpful but, since it is added in the Android view mode, looks weird and unfamiliar. But there is no harm of seeing it in there.

Sorry to disappoint you




回答3:


Right click on generated, then Hide ignored files.




回答4:


There are several schemes in which android studio displays project tree. If you are really troubled with generated java directory, you may try other schemes.

Many of the schemes for example Project Source Files does not show generatedJava directory.

Hope this helps somewhat.



来源:https://stackoverflow.com/questions/52400081/how-to-remove-generatedjava-from-android-studio-3-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!