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
Tonnie Fanadez
UX Design Techdegree Graduate 22,163 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