在 Android Studio 中清理项目 vs 重建项目 vs 运行项目 [英] Clean Project vs Rebuild Project vs Run Project in Android Studio

查看:56
本文介绍了在 Android Studio 中清理项目 vs 重建项目 vs 运行项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道或知道这三个函数在 android studio 中是如何工作的详细答案(我认为 Eclipse,可能还有 IntelliJ,具有相同或相似的功能).我已经看到并被告知答案,这些答案简要概述了它们的工作原理,据我所知,重建也将清理项目,并且运行该项目会运行可用代码的最后构建版本.最终,我只是想深入了解这三个函数如何相互配合/在彼此内部工作,以及在运行最新的应用程序版本之前是否有必要先运行一个.

解决方案

使用 gradle,更具体地说是 gradle 包装器,您可以通过在从项目的根目录运行时添加 info 标签来准确地查看每一个都在做什么.

将向您展示可从根项目运行的主要任务./gradlew 任务

将显示您项目中的所有可用任务./gradlew 任务 --all

您可以使用

了解有关任何任务的更多信息

./gradlew help --task <任务>

Android 任务

<块引用>

androidDependencies - 显示项目的 Android 依赖项.

signingReport - 显示每个变体的签名信息.

sourceSets - 打印出此项目中定义的所有源集.

构建任务

<块引用>

assemble - 组装所有应用程序和辅助包的所有变体.

assembleAndroidTest - 组装所有测试应用程序.

assembleDebug - 组装所有调试版本.

assembleDevelopment - 组装所有开发版本.

assembleRelease - 组装所有发布版本.

build - 组装和测试这个项目.

buildDependents - 组装和测试这个项目和所有依赖它的项目.

buildNeeded - 组装和测试这个项目和它依赖的所有项目.

mockableAndroidJar - 创建一个适合单元测试的 android.jar 版本.

构建设置任务

<块引用>

init - 初始化一个新的 Gradle 构建.[孵化]

wrapper - 生成 Gradle 包装文件.[孵化]

验证任务

<块引用>

check - 运行所有检查.

clean - 删除构建目录.

connectedAndroidTest - 在连接的设备上安装和运行所有风格的仪器测试.

connectedCheck - 在当前连接的设备上运行所有设备检查.

connectedDevelopmentDebugAndroidTest - 安装并运行测试在连接的设备上进行开发调试.

deviceAndroidTest - 使用所有设备提供程序安装和运行仪器测试.

deviceCheck - 使用设备提供程序和测试服务器运行所有设备检查.

lint - 在所有变体上运行 lint.

lintDevelopmentDebug - 在 DevelopmentDebug 版本上运行 lint.

lintDevelopmentRelease - 在 DevelopmentRelease 版本上运行 lint.

这是学习项目可用的 ./gradlew 命令的好方法

Does anyone have or know of a detailed answer to how these three functions in android studio work (I think Eclipse, and probably IntelliJ also, have the same or similar functions). I have seen and been told answers that give a brief outline of how they work and from what I understand a rebuild will also clean the project and running the project runs the last built version of the available code. Ultimately, I am just looking for an in depth explanation of how these three functions work with/inside of each other and whether it is necessary to run one before the other before running the latest app version.

解决方案

Using gradle and more specifically the gradle wrapper you can see exactly what each of these is doing by adding an info tag when running from the root of your project.

Will show you the main tasks runnable from root project ./gradlew tasks

Will show you all tasks available in your project ./gradlew tasks --all

you can find out more about any tasks by using

./gradlew help --task <task>

Android tasks

androidDependencies - Displays the Android dependencies of the project.

signingReport - Displays the signing info for each variant.

sourceSets - Prints out all the source sets defined in this project.

Build tasks

assemble - Assembles all variants of all applications and secondary packages.

assembleAndroidTest - Assembles all the Test applications.

assembleDebug - Assembles all Debug builds.

assembleDevelopment - Assembles all Development builds.

assembleRelease - Assembles all Release builds.

build - Assembles and tests this project.

buildDependents - Assembles and tests this project and all projects that depend on it.

buildNeeded - Assembles and tests this project and all projects it depends on.

mockableAndroidJar - Creates a version of android.jar that's suitable for unit tests.

Build Setup tasks

init - Initializes a new Gradle build. [incubating]

wrapper - Generates Gradle wrapper files. [incubating]

Verification tasks

check - Runs all checks.

clean - Deletes the build directory.

connectedAndroidTest - Installs and runs instrumentation tests for all flavors on connected devices.

connectedCheck - Runs all device checks on currently connected devices.

connectedDevelopmentDebugAndroidTest - Installs and runs the tests for developmentDebug on connected devices.

deviceAndroidTest - Installs and runs instrumentation tests using all Device Providers.

deviceCheck - Runs all device checks using Device Providers and Test Servers.

lint - Runs lint on all variants.

lintDevelopmentDebug - Runs lint on the DevelopmentDebug build.

lintDevelopmentRelease - Runs lint on the DevelopmentRelease build.

This is a good way to learn the ./gradlew commands available for your project

这篇关于在 Android Studio 中清理项目 vs 重建项目 vs 运行项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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