Android Studio 中 make 和 build 的区别

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20375863/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 02:46:02  来源:igfitidea点击:

Difference between make and build in Android Studio

androidandroid-studio

提问by cja

The Android Studio Build menu has options including

Android Studio Build 菜单的选项包括

Make Project
Rebuild Project

When should I use each?

我应该什么时候使用?

采纳答案by Grzegorz ?ur

Most of the time you should use Make Project. Sometimes, after adding libraries and making big changes to the project you should use Rebuild Project.

大多数情况下,您应该使用Make Project。有时,在添加库并对项目进行重大更改后,您应该使用Rebuild Project

If you look at the menu, you'll see that Make Projectand Compilehave keyboard shortcuts, that suggests that they are often used. Others are seldom used.

如果您查看菜单,您会看到Make ProjectCompile有键盘快捷键,这表明它们经常被使用。其他的很少使用。

It is the same as IntelliJ Idea.

它与 IntelliJ Idea 相同。

Compile All the source files in the specified scope are compiled. The scope in this case may be a file, a package, etc.

Make ProjectAll the source files in the entire project that have been modified since the last compilation are compiled. Dependent source files, if appropriate, are also compiled. Additionally, the tasks tied to the compilation or make process on modified sources are performed. For example, EJB validation is performed if the corresponding option is enabled on the Validation page.

Make ModuleCompiled are all the source files that have been modified since the last compilation in the selected module as well as in all the modules it depends on recursively.

Rebuild ProjectAll the source files in the project are recompiled. This may be necessary when the classpath entries have changed, for example, SDKs or libraries being used added, removed or altered

Compile 编译指定范围内的所有源文件。在这种情况下,范围可能是文件、包等。

Make Project编译整个工程中自上次编译后修改过的所有源文件。如果合适,还会编译相关的源文件。此外,执行与修改源的编译或制作过程相关的任务。例如,如果在“验证”页面上启用了相应的选项,则会执行 EJB 验证。

Make ModuleCompiled 是所选模块及其递归依赖的所有模块中自上次编译以来修改过的所有源文件。

重新编译项目 重新编译项目中的所有源文件。当类路径条目发生更改时,这可能是必要的,例如,添加、删除或更改正在使用的 SDK 或库

Copied from IntelliJ Idea 13 help.

复制自IntelliJ Idea 13 帮助

回答by miguel

The difference is that Rebuild executes gradle's clean task first. If you look in the Gradle Console 'Rebuild Project' will say something like

不同的是Rebuild会先执行gradle的clean任务。如果您查看 Gradle 控制台“重建项目”会说类似的话

Executing tasks: [clean, :app:compileDebugSources, :app:compileDebugAndroidTestSources]

While 'Make Project' won't have clean

虽然“制作项目”不会有 clean

Executing tasks: [:app:compileDebugSources, :app:compileDebugAndroidTestSources]

回答by rupesh jain

Difference between make and rebuild is "clean" task.

make 和rebuild 之间的区别是“干净”的任务。

When you do rebuild projectit performs clean too.

当您重建项目时,它也会执行干净。