android - gradle 在哪里存储 ANDROID 项目的所有编译类?

标签 android android-studio gradle android-gradle-plugin build.gradle

从 Eclipse 迁移到 Android Studio。这是 AS 的构建目录结构

enter image description here

问题1.gradle把所有编译好的.class放在哪里?文件?是projectRoot/build/intermediates/classes吗目录?

这个问题的目的是在构建时生成一个 Java 类(例如:CustomBuildInfo.java)并且需要添加到编译目录以便其他 src 文件可以使用它并在 APK 中正确打包。

注意:以前在 Eclipse 中,此生成的文件用于驻留在 projectRoot/gen/<package> 中目录。

问题 2.自定义生成的 Java 文件的正确位置是什么?是build/generated/r/<buildType>/<package> ? (这是 R.java 所在的位置)

注意 但是这个自定义生成的 Java 文件 CustomBuildInfo.java属于共同来源,即被所有构建类型和所有风格使用

我们将不胜感激。

最佳答案

在使用 GRADLE 构建系统时回答我自己的问题

  • Java字节码位置(编译后)<projectroot>/build/intermediates/classes/<build-type>/....

  • Assets
    <projectroot>/build/intermediates/assets/<build-type>/....

  • 资源 <projectroot>/build/intermediates/res/merged/<build-type>/....

  • JNI 库(可配置) <projectroot>/build/intermediates/jniLibs/<build-type>/....

  • list <projectroot>/build/intermediates/manifests/full/<build-type>/....

  • 从 AIDL 生成的 Java 类 <projectroot>/build/generated/source/aidl/<build-type>/....

  • R.java <projectroot>/build/generated/source/r/<build-type>/....

  • BuildConfig.java <projectroot>/build/generated/source/buildConfig/<build-type>/....

  • 测试报告 HTML <projectroot>/build/reports/tests/<build-type>/index.html

  • APK 输出文件 <projectroot>/build/outputs/apk/...

  • Lint 结果 <projectroot>/build/outputs/...

  • list 合并报告(如果使用多模块构建) <projectroot>/build/outputs/logs/...

  • 测试结果 <projectroot>/build/test-results/...

关于android - gradle 在哪里存储 ANDROID 项目的所有编译类?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34624867/

相关文章:

android - 选项卡主机中的 Activity 变为空白

Android 模拟器启动后自动关闭

android - 编译时"All com.android.support libraries must use the exact same version specification"android.support :appcompat-v7:25. 2.0

gradle - 如何在Gradle中运行用Maven构建编写的代码

android - Flutter 需要 Android SDK 29 和 Android BuildTools 28.0.3,同时两者都有

android - 仅限 ACCESS_FINE_LOCATION 权限错误模拟器

java - 无法启动 Activity ComponentInfo : Error inflating class android. support.design.widget.CoordinatorLayout

gradle - 如何通过gradle将本地依赖项捆绑到jar构建中?

android - 我们应该使用 ionic 框架来构建大型移动应用程序吗?

java - Android Studio 3.2.1之后的构建错误