android studio中clean工程和rebuild工程的区别

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24083706/
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 07:46:38  来源:igfitidea点击:

Difference between clean project and rebuild project in android studio

androidandroid-studiointellij-idea

提问by Fukkong

What is the difference between Clean Projectand Rebuild Project(in Android Studio)?

Clean ProjectRebuild Project(在 Android Studio 中)有什么区别?

  • I had a problem with the R fileabout resids, so I changed the file extension from gifto pngand then [my build failed.]
  • I found the solution was to Rebuild Project. This prompts my question above.
  • 我的R fileabout有问题resids,所以我将文件扩展名从 更改gifpng,然后 [我的构建失败。]
  • 我发现解决方案是Rebuild Project. 这提示了我上面的问题。

回答by Larry Schiefer

A clean just removes all build artifacts. A rebuild does a clean followed by a build of your project.

清理只是删除所有构建工件。重建会先清理,然后再构建您的项目。

EDIT #2This is 100% true. Refer to thisfor a thorough demonstration of its correctness.

编辑 #2这是 100% 正确的。请参阅以彻底证明其正确性。

回答by MBH

What I experienced,

我所经历的,

When you do clean, it removes the binaries inside buildfolders, and postpones building them again to the next run.

当您执行清理时,它会删除构建文件夹中的二进制文件,并将它们再次构建到下一次运行。

When you do rebuild, it does clean and rebuild for those files inside buildfolder, which rebuilt again in the next run. It does not rebuild the APK!! Which is really weird.

当您进行重建时,它会清理并重建build文件夹中的那些文件,这些文件会在下次运行时再次重建。它不会重建APK!!这真的很奇怪。

so:

所以:

Clean removes the build folders contents.

Clean 删除构建文件夹的内容。

Rebuild removes the build folder's contents. And builds some binaries; not including the APK!

重建删除构建文件夹的内容。并构建一些二进制文件;不包括APK!

BTW, I am using Android studio 2.0 Preview 7.

顺便说一句,我使用的是 Android studio 2.0 Preview 7。