Android Studio 3.2 生成的java [英] Android Studio 3.2 Generated java

查看:47
本文介绍了Android Studio 3.2 生成的java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在最新版本中更新了 android studio,这里有一个名为 Generated Java 的新目录,如果我从项目的根目录中删除此目录,谁能解释它是什么以及对项目的任何影响.

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 directory from root directory of project.

如果您对此有所了解,请告诉我.

Please let me know if you know anything about it.

谢谢

推荐答案

此文件夹已经在您的项目中,只是现在在项目资源管理器的 Android 视图模式中突出显示.它的位置实际上是build/generated/source/r///.

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>/.

您可以在此处找到的类是用于构建项目的所有类,包括库.当您遇到生成的代码(例如注释处理器)问题时,检查这些可能会很有用.例如,数据绑定库、ButterKnife 或 Dagger 2 都根据您的注释生成 java 类,您可以在此目录中看到.

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.

这篇关于Android Studio 3.2 生成的java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆