Pocket Studio Academy
HomePart 00.3

Your first app: build and install it

Free lesson12 min read·4 questions

Right now, on this phone, you are going to make an app that does not exist yet, build it into a real APK, install it, and see your own words on the screen. No theory first. The theory makes far more sense afterwards.

An icon on your home screen, made by you

This is the lesson everything else is built on.

By the end of it there will be an icon on your home screen that was not there this morning. Tapping it will open an app that says something you chose. It will be a real Android app — the same kind of file people download from Google Play — sitting on your phone because you made it.

You will not understand every line yet. That is completely fine and completely deliberate. Lesson 0.4 takes the whole thing apart afterwards, and it lands far better once you have the app in your hand.

One promise before we start: the first build is slow. Several minutes, possibly close to ten. It looks like nothing is happening. Nothing is broken. This lesson tells you exactly what you will see while you wait, so you never once wonder whether it has frozen.

Think of it like this

The first time you bake bread, most of the time is not baking.

It is the oven heating up, and the yeast waking up, and the dough proving on the counter. You stand there thinking surely something should be happening by now. Then it all happens at once and you have bread.

The second loaf is much faster, because the oven is already hot.

Your first is the cold oven. has to fetch the Android tools and the your app leans on, and that download only happens once, ever. Your second build takes under a minute. Every build after that, too.

Before you tap anything

Thirty seconds of preparation that prevents the two most common first-build failures.

  • Storage. Free up about 3 GB. The Android build tools and the libraries Gradle fetches are genuinely large. Old videos are usually the fastest win.
  • Power. Plug the phone in, or start above 50%. Compiling is real work and the battery notices.
  • Network. You need Wi-Fi for this one build. After today you can build on a train with aeroplane mode on.
  • Heat. If the phone is warm from gaming, give it two minutes. A hot phone slows itself down deliberately, and a slow build is a build you will be tempted to interrupt.

Step 1 — Make the project

Open and tap Projects, then New Project.

You will be asked to choose a . Pick the one for an Empty Compose Activity — the name may be shortened to Empty Activity or Compose. It is the one that produces a project with a single screen and nothing else, which is exactly what you want.

Then four fields. Here is what each one actually means.

FieldType thisWhat it is
NameHello PocketThe human name. It shows under the icon on your home screen.
Packagecom.yourname.hellopocketThe app's permanent, unique ID.
Minimum SDKAPI 26 (Android 8.0)The oldest Android this app will install on.
LanguageKotlinThe language. It is probably the only option.

Replace yourname in the package with something of your own — your first name, your initials, anything. com.amara.hellopocket is fine. Lower case, no spaces, no dashes.

That package becomes your app's . Android uses it to tell your app apart from every other app on Earth. Two apps with the same ID cannot both be installed, which is why nobody sensible ships com.example.myapp.

26 means Android 8.0 and newer. That is around 95% of phones in use, and it saves you configuring workarounds for old versions you will never test on.

Now tap Create.

Step 2 — What you are looking at

Pocket Studio makes a folder full of files and opens it. Do not read them all. Lesson 0.4 does that properly. For now, exactly one file matters:

text
app/src/main/java/com/yourname/hellopocket/MainActivity.kt

Find it in the project tree — tap app, then src, then main, then java, then your package folders, then MainActivity.kt. Tap the file name to open it in the Editor.

9:41▲ ▮
MainActivity.kt
10 class MainActivity : ComponentActivity() {
11  override fun onCreate(state: Bundle?) {
12   super.onCreate(state)
13   setContent {
14    MaterialTheme {
15     Greeting()
16    }
17   }
18  }
19 }
20
21 @Composable
22 fun Greeting() {
23  Text("Hello Pocket")
24 }
Projects
Editor
Build

MainActivity.kt open in the Editor. Line numbers on, as set up in 0.2.

Here is the whole file. Yours may have a couple of extra lines depending on the template version — that is normal, and none of them get in the way.

Step 3 — Make it yours

Tap on line 23, between the quotation marks, and change the words. Use your own name:

MainActivity.ktkotlin
1@Composable
2fun Greeting() {
3  Text("Hello, Amara")
4}

Two rules, and they are the whole reason people's first build fails:

  • Keep both quote marks. "Hello, Amara" — one at each end. Delete one and the stops dead.
  • Type real text, not a name from the code. Anything human is fine. Emoji work too.

Now save. Pocket Studio usually saves as you type, but if there is a Save action, use it.

Step 4 — Press Run, then read this while you wait

Go to the Build tab and tap the Run triangle ▶.

Then leave the phone alone. Do not lock the screen, do not switch apps, do not tap Run a second time. Read the next two pages instead — they describe, in order, exactly what is about to scroll past.

What the wall of text means

text
1Downloading gradle-8.11.1-bin.zip
2.........10%.........20%.........30%
3Starting a Gradle Daemon
4> Configure project :app
5> Task :app:preBuild UP-TO-DATE
6> Task :app:generateDebugResValues
7> Task :app:processDebugMainManifest
8> Task :app:mergeDebugResources
9> Task :app:processDebugResources
10> Task :app:compileDebugKotlin
11> Task :app:dexBuilderDebug
12> Task :app:mergeExtDexDebug
13> Task :app:packageDebug
14> Task :app:assembleDebug
15
16BUILD SUCCESSFUL in 6m 41s
1734 actionable tasks: 34 executed
Line on screenWhat is happeningRoughly
Downloading gradle-...zipFetching Gradle itself. Once, ever.1–3 min
Starting a Gradle DaemonGradle is starting a background helper that stays warm for later builds.20–60 s
Configure project :appReading your build settings and downloading the libraries listed there.1–4 min
compileDebugKotlinYour Kotlin becoming machine-readable. This is the quiet one.30–120 s
dexBuilderDebugRepacking that output into the format Android runs.20–60 s
packageDebugZipping everything into the [[apkAPK]].10–30 s
BUILD SUCCESSFULDone.
Careful

> Task :app:compileDebugKotlin can sit on screen with no visible movement for a full two minutes on the first build. There is no progress bar. This is the single most common moment people decide it has frozen and force-quit.

It has not frozen. The is working. If the phone is warm to the touch, that is the proof. Wait.

Some things you may also see, all of them normal:

  • Percentages that stall at 40% for a while, then jump. That is the network, not a bug.
  • Note: Some input files use unchecked or unsafe operations — a note, not an error. Notes and warnings never stop a build.
  • A line beginning w: — a warning from Kotlin. Also harmless. Lesson 0.6 explains the difference between w: and e: properly.
9:44▲ ▮
Build
■ Stop
Starting a Gradle Daemon
> Configure project :app
> Task :app:preBuild UP-TO-DATE
> Task :app:generateDebugResValues
> Task :app:processDebugMainManifest
> Task :app:mergeDebugResources
> Task :app:processDebugResources
> Task :app:compileDebugKotlin
Still going
No progress bar here is normal.
Leave it. It is compiling.
Projects
Editor
Build

The Build tab, mid-build. Nothing is frozen — compileDebugKotlin is thinking.

Step 5 — Android asks permission to install

When BUILD SUCCESSFUL appears, Android takes over and shows a system dialog. Depending on your phone, you may see one or two of these.

"For your security, your phone is not allowed to install unknown apps from this source." This is the setting. Android only lets an app install other apps if you have said it may. Tap Settings in that dialog, turn on Allow from this source for Pocket Studio, then press Back. You do this once.

"Do you want to install this application?" Tap Install. A few seconds later: App installed. Tap Open.

"Send app to Google for scanning?" — Play Protect being cautious about an app that did not come from the Play Store. Install anyway or Send are both fine. It is your app; you watched it being made.

Step 6 — It is running

Your words. On your screen. In an app you built.

9:47▲ ▮
Hello, Amara

Hello Pocket, running. Dark or light depends on your phone's setting — MaterialTheme handles both.

Plain, isn't it. That is worth sitting with for a second, because plain is the point: there is no trick in it. A blank screen with one line of text, and every pixel of it came from the file you just read.

Now press the home button and find the new icon. It says Hello Pocket under a default green Android robot. Tap it. It opens without Pocket Studio being involved at all — it is a normal installed app now. Turn on aeroplane mode and it still opens, because everything it needs is already on the phone.

What you actually did

Four things, in about ten minutes:

  1. Created an Android — a folder with your code and its build settings.
  2. Edited one of text inside a function.
  3. Ran , which compiled your and packaged it into app-debug.apk.
  4. Installed that APK on a real phone.

That is not a beginner's version of app development. That is app development. Every remaining lesson in this course is the same four steps with more interesting things in step 2.

Tip

Build number two will be dramatically faster. Change the text again and press Run: expect 20 to 60 seconds. Gradle already has everything downloaded, the daemon is warm, and it only recompiles what changed.

Because Free-tier builds are limited in number, get into the habit now: make several changes, read them, then build. It is a better working rhythm anyway.

Try it in Pocket Studio

The one-page version. Follow this with the phone in your hand.

  1. Free up about 3 GB of storage and plug the phone in.
  2. Open Pocket StudioProjectsNew Project.
  3. Choose the Empty Compose Activity template.
  4. Name: Hello Pocket. Package: com.yourname.hellopocket — swap in your own name, lower case. Minimum SDK: API 26. Language: Kotlin.
  5. Tap Create and wait for the project to open.
  6. In the project tree open appsrcmainjava → your package → MainActivity.kt.
  7. Find the line reading Text("Hello Pocket"). Tap between the quote marks and type your own greeting. Keep both quote marks.
  8. Tap Build, then the Run triangle ▶.
  9. Wait. Do not lock the screen or press Run again. On the first build, expect 4–10 minutes, with a long silent pause at compileDebugKotlin.
  10. When Android asks, allow install unknown apps for Pocket Studio, then tap Install, then Open.
  11. Read your own words on the screen. Then press Home and tap the new Hello Pocket icon to prove it is a real installed app.
  12. Go back to Pocket Studio, change the greeting once more, and press Run again. Time it. That number — under a minute — is your normal from now on.
Error Doctor5 common errors
Could not resolve all files for configuration ':app:debugRuntimeClasspath'. > Could not resolve androidx.compose.material3:material3.
MeansGradle could not download a library it needs. Nine times out of ten the network dropped part-way through the first build; occasionally a school or office Wi-Fi blocks the download.
FixCheck you are online, then press Run again — Gradle keeps whatever it already downloaded and carries on. If it fails at the same place twice, try mobile data or a different Wi-Fi network.
e: file:///.../MainActivity.kt:23:24 Expecting '"'
MeansA piece of text is missing its closing quote mark. Kotlin read to the end of the line still waiting for the " that would finish your greeting.
FixGo to that line — 23 here — and count the quote marks. There must be exactly two, one at each end: Text("Hello, Amara").
INSTALL_FAILED_INSUFFICIENT_STORAGE
MeansThe APK was built successfully, but there is not enough free space on the phone to install it. Note that the build itself also needs room for its own working files.
FixFree up 1–2 GB and tap Run again. You do not need to rebuild from scratch — Gradle reuses everything and goes straight to the install step.
INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package com.yourname.hellopocket signatures do not match previously installed version; ignoring!
MeansAn app with this same package name is already installed, but it was signed with a different key — usually an earlier attempt, or the same project rebuilt after a reinstall of Pocket Studio.
FixUninstall the old Hello Pocket from your home screen (long-press → Uninstall), then press Run again.
java.lang.OutOfMemoryError: Java heap space
MeansThe build ran out of working memory. Compiling is genuinely memory-hungry, and on a phone it is competing with everything else you have open.
FixSwipe away your other apps in the recents view, then press Run again. If it repeats, restart the phone and build before opening anything else.
Recap
  • You created a real Android from a , changed one line, and pressed Run.
  • compiled your and packaged it into app-debug.apk, and Android installed it.
  • The first build is slow because Gradle downloads its tools and once. A long silent pause at compileDebugKotlin is normal, not a freeze.
  • What is on your home screen now is a genuine app. It runs offline, with Pocket Studio closed.
  • Next: we open the box. Every file in that project, what it is for, and where app-debug.apk actually came from.