eclipse 什么是 Android 中的 bin 文件夹?

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

What is a bin folder for in Android?

androideclipseapkbin

提问by Ahmed

I heard that a bin folder is a binary and is executable. But I'm not quite sure how it affects my project as a whole? It seems to duplicate all my image resources besides having my apk in it thereby almost more than doubling my project size.

我听说 bin 文件夹是二进制文件并且是可执行的。但我不太确定它如何影响我的整个项目?除了在其中包含我的 apk 之外,它似乎复制了我的所有图像资源,从而使我的项目大小几乎翻了一番。

Can someone please understand it's primary functionality and why it should not be tampered/deleted?

有人可以理解它的主要功能以及为什么它不应该被篡改/删除吗?

回答by waqaslam

It's generated by the compiler, which contains all of the .classfiles to produce an .apkfile. Your debug application file, .apk, resides there too once it is built successfully.

它由编译器生成,其中包含.class生成.apk文件的所有文件。.apk成功构建后,您的调试应用程序文件 也驻留在那里。

Ignore Them In Your Version Control System

在您的版本控制系统中忽略它们

In case you are managing your projects in a Version Control System(e.g. Git, SVN), you may ignore the binand gendirectories, since they are generated by your IDEautomatically.

如果您在版本控制系统(例如 Git、SVN)中管理您的项目,您可以忽略bingen目录,因为它们是由您的IDE自动生成的。

回答by kabuko

The compiler uses the bin folder as a sort of staging area to prepare your files to be finally packaged into your APK. This includes compiling your Java code into class files and also putting your resources (including images) into a certain structure to be zipped into the APK. It's required to have a separate copy because the Android SDK does some preprocessing on these images before packaging.

编译器使用 bin 文件夹作为一种暂存区来准备您的文件,以便最终打包到您的 APK 中。这包括将您的 Java 代码编译成类文件,并将您的资源(包括图像)放入特定结构中以压缩到 APK 中。需要有一个单独的副本,因为 Android SDK 在打包之前对这些图像做了一些预处理。

After your APK is created, it's safe to delete these images. In fact if you go to Project -> Clean in Eclipse, it will clean up this folder for you. There's usually no need to though, and these files will get regenerated next build anyway.

创建 APK 后,可以安全地删除这些图像。事实上,如果你在 Eclipse 中进入 Project -> Clean,它会为你清理这个文件夹。不过通常没有必要,这些文件无论如何都会在下一次构建时重新生成。

If you are backing up your project or using source control, you don't have to include the bin folder (and probably shouldn't in the case of source control).

如果您要备份项目或使用源代码管理,则不必包含 bin 文件夹(在源代码管理的情况下可能不应该包含)。