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.
Can someone please understand it’s primary functionality and why it should not be tampered/deleted?
It’s generated by the compiler, which contains all of the
.class files to produce an
.apk file. Your debug application file,
.apk, resides there too once it is built successfully.
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
gen directories, since they are generated by your IDE automatically.
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.
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.
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).