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

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

问题描述

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

解决方案

使用gradle,更具体地说,通过gradle包装器,您可以在从项目的根目录运行时添加一个info标签,从而确切地了解它们的作用./p>

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

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

您可以使用来查找有关任何任务的更多信息

  ./gradlew help --task< task> 

Android任务

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

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

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

构建任务

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

assembleAndroidTest -组装所有的Test应用程序.

assembleDebug -组装所有Debug版本.

assembleDevelopment -组装所有开发版本.

assembleRelease -组装所有Release版本.

build -组装并测试该项目.

buildDependents -组装并测试该项目以及所有依赖该项目的项目.

buildNeeded -组装并测试该项目及其依赖的所有项目.

mockableAndroidJar -创建适用于单元测试的android.jar版本.

构建设置任务

init -初始化新的Gradle构建.[正在孵化]

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

验证任务

check -运行所有检查.

clean -删除构建目录.

connectedAndroidTest -为连接的设备上的所有版本安装并运行检测测试.

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

connectedDevelopmentDebugAndroidTest -安装并运行测试连接设备上的developmentDebug.

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天全站免登陆