What is a bin folder for in Android?
Asked Answered
S

2

22

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?

Swami answered 23/2, 2012 at 21:34 Comment(0)
T
41

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 bin and gen directories, since they are generated by your IDE automatically.

Telling answered 23/2, 2012 at 21:37 Comment(1)
Thanks--I was wondering if I should save this directory needs version control or not.Run
Y
12

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).

Yorkshire answered 23/2, 2012 at 21:44 Comment(1)
Thank you for pointing out the fact that I can 'Clean' this folder! This helps...Swami

© 2022 - 2024 — McMap. All rights reserved.