Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Simple Android App with Java Getting Started with Android Running the Fun Facts Project

Alice Walden
Alice Walden
2,001 Points

'Build' vs 'Run'

When and why should I use 'Build' instead of 'Run'? Is it quicker or what are the advantages?

2 Answers

Nicolas Connor
Nicolas Connor
3,410 Points

My understanding is that build simply turn your java code into machine code. When you click on run, your computer will first build your code into machine code then that machine code is read by your computer to "run" the app you built. Computers can't understand java without it being translated to machine code first by your ide.
My understanding is that bugs sometime appears when you attempt to build it, by running an app you can discover even more bugs that may happen when you interact with the user interface.

Tonnie Fanadez
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Tonnie Fanadez
UX Design Techdegree Graduate 22,796 Points

Good Question Alice Walden

When you click RUN Android Studio generates a debug version of the APK file which is meant only for installation on the current test device or the emulator. For example with RUN AS auto detects the resolution of the test device and loads only the resources for that specific resolution to the APK File - so if your device has HDPI resolution, all other screen resolutions are ignored and are not generated.

On the other hand when you click BUILD AS generates all resources needed to run on a phone or a tablet .

Cheers