# 09.2 Build APK (with Android Studio)

1. Open the project in Android Studio\
   \
   `File > Open`\\

2. Select the `android` folder in the frontend folder and open it.\\

3. Wait for *everything* to load. If prompted to upgrade the gradle, **upgrade the gradle**

![](https://2271095790-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MkEqfPApcEHhLd8Bwvl%2F-MkOLM9XqE1Vjzo1iqVl%2F-MkONdm1R4f8y4aAA3pF%2Fgradle-upgrade.png?alt=media\&token=38765bf0-6300-432d-80fe-0ed537a1e73a)

4\. Click `Build` in the top menu and select `Make Project`\
\
I like to open the Build logs and watch what's happening, but it's optional

![](https://2271095790-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MkEqfPApcEHhLd8Bwvl%2F-MkOLM9XqE1Vjzo1iqVl%2F-MkOORg66FixPcBGsbaM%2Fbuil-logs-tab.png?alt=media\&token=7a143ef9-5f20-4aaf-94cd-6cca95110229)

If everything worked and you see `Build Succeeded!` in the log, skip down to step 5. Otherwise, read on, it should be a simple fix!\
\
If you get an error like: \
\
`Cause: compileSdkVersion is not specified. Please add it to build.gradle`

Don't fret! Just expand the `Gradle Scripts` folder in the file-tree on the left hand side and double click the file `build.gradle (Module: android.app)`

![](https://2271095790-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MkEqfPApcEHhLd8Bwvl%2F-MkOLM9XqE1Vjzo1iqVl%2F-MkOR025aLVfef4C8qhb%2Fgradle-filetree.png?alt=media\&token=cb437675-9fc0-4946-9378-00d48445c9bf)

In the code window on the right hand side, we need to change three things: `compileSdk`, `minSdk` and `targetSdk`. Edit the file so it looks like this:

![](https://2271095790-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MkEqfPApcEHhLd8Bwvl%2F-MkOLM9XqE1Vjzo1iqVl%2F-MkORs3EZJA6QRSoeTIl%2Fchange-sdk-versions.png?alt=media\&token=a8cbb354-e969-4656-afb5-23a53c42d540)

Save `Ctrl + S` and try to build again. `Build > Make Project`

If you see something like this, you're all good!

![](https://2271095790-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MkEqfPApcEHhLd8Bwvl%2F-MkOLM9XqE1Vjzo1iqVl%2F-MkOSFl2g_UuAoxLWC9J%2Fbuild-successful.png?alt=media\&token=81f13e7b-134b-48cc-b002-7989c55a18e4)

5\. Now go to `Build > Build Bundle(s)/APK(s) > Build APK(s)`

Your APK should build and an alert should appear in the corner giving you the option to open the folder where the APK was compiled. In that folder you should see `app-debug.apk` and an `output-metadata.json` file.

YAAASSSSSSSSSSS!!! 🎉🎉💃 Great Success!! Now just get that thing on your device and we're golden!

**Note:** I believe the error situation above is caused by something not being set in a config file, but I haven't been able to narrow down exactly what it is. Please know that I am working on that. But once you've done it once it should be set for good unless you delete the project and re-clone the repo. And as a bonus, now that it's all set up here, you can build from the terminal too with one simple command:\
\
`./gradlew assembleDebug`

**Note 02:** I added the `android` folder to the main branch of the repo so the issue mentioned above (hopefully) should not happen anymore and Android Studio should have the correct information.
