Android Studio 3.2 Generated java

后端 未结 2 2055
甜味超标
甜味超标 2020-12-31 08:53

I just updated android studio in latest version and here is a new directory named Generated Java, can anyone explain what is it and any effect on projects if I delete this d

相关标签:
2条回答
  • 2020-12-31 09:35

    This folder has already been in your project, only now it is highlighted in the Android view mode of the project explorer. Its location is actually build/generated/source/r/<current flavor>/<current build type>/.

    The classes you can find here are all the classes the project will be built from, including the libraries. Inspecting these could be useful when you are having issues with generated code, such as annotation processors. For example, the databinding library, ButterKnife, or Dagger 2 all generate java classes based on your annotations, which you can see in this directory.

    If you delete the directory, it will make the next build slower, because it needs to regenerate these files again, instead of reusing them. Which means they will reappear anyways, so there's no point in doing that.

    0 讨论(0)
  • 2020-12-31 09:43

    One of the new features that came with Android Studio 3.2.1

    You can actually edit them, but when they will be regenerated, all your edits will be lost. If you open one such file, Android Studio will show the message:

    Files under the "build" folder are generated and should not be edited.

    And if you try to edit it anyway, the message changes to:

    Generated source files should not be edited. The changes will be lost when sources are regenerated

    0 讨论(0)
提交回复
热议问题