13

Android studio 3.2

enter image description here

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?

Bhuvanesh BS
  • 11,405
  • 10
  • 36
  • 61
  • After rebuilding the project it is reappearing. – Bhuvanesh BS Sep 19 '18 at 07:25
  • So, that might be an *autogenerate* folder using by AS itself? Also, that's RC version so, might not be stable enough. You may however check `build.gradle`. – ʍѳђઽ૯ท Sep 19 '18 at 07:27
  • I guess so. But, the Stable release will be released after a few months. Already waited a long time. So, finding a way around to remove it. – Bhuvanesh BS Sep 19 '18 at 07:29
  • 2
    **WHY** do you want to remove it? If it is not you who created it, it looks like it is needed for AS itself. Don't you think that finding a way to remove it (and to stop it appearing after build) will result in AS not working? – Vladyslav Matviienko Sep 19 '18 at 07:37
  • 2
    Android Folder structure should show only what we need right. There are no use of generated files for us. – Bhuvanesh BS Sep 19 '18 at 07:44

3 Answers3

12

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.

Adam
  • 1,043
  • 9
  • 21
0xAliHn
  • 16,415
  • 20
  • 78
  • 97
  • 8
    +1, Nice and good explanation. But nothing should be forced to keep. I'm not going to look into a generated folder. It can be somewhere else so I could view it on my need. – Bhuvanesh BS Sep 25 '18 at 08:11
  • 2
    Because when I control+click on package at the top of the file, it navigates to generatedJava folder. Also, IDES are for writing code, not for looking at code. What's the point of it appearing there if I can't edit it? I can navigate to these folder using explorer like we did when this subtree did not exist. I wonder who thought that this would be a good idea... – mitsest Nov 12 '18 at 13:34
  • A massive +1 on the ctrl+click on the package. This has negatively impacted the way I navigate. I'm all for an accessable generatedJava (though I hardly ever find myself there), but ctrl+click defaulting to the genrated files makes no sense to me. – Arsala Bangash Nov 12 '18 at 22:30
4

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

build/generated/source/r/<current flavor>/<current build type>/

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

ʍѳђઽ૯ท
  • 15,369
  • 7
  • 47
  • 103
0

Right click on generated, then Hide ignored files.

Armali
  • 14,228
  • 13
  • 47
  • 141
  • Hi Shams, Welcome to Stack Overflow. I understand that you don't have enough reputation to comment. But, don't post comments as an answer. Earn reputation by posting valid answers with references. Also, the same info already posted by @K M Rejowan Ahmmed. – Bhuvanesh BS Oct 23 '18 at 10:58
  • 1
    I like this answer. The question however is like work when people complain about automated process emails. – danny117 Oct 23 '18 at 18:16