CS 3180 Mobile Application Development

Week 2: Android Platform & Android Studio

CS 3180 — Mobile Application Development

Architecture · Build System · IDE Mastery · Hope Foundation Context

Week 2 Monday: Android Platform & Android Studio
CS 3180 Mobile Application Development

Client Context: Maria's Challenge

"We need the app to work even when the signal drops."
— Maria, Hope Foundation Event Coordinator

Her volunteers' phones range from 2019 to 2024

This week's goal: configure CharityGolfTracker properly for that diversity

Week 2 Monday: Android Platform & Android Studio
CS 3180 Mobile Application Development

Android Platform Architecture

Week 2 Monday: Android Platform & Android Studio
CS 3180 Mobile Application Development

The Android Stack

Android is a layered platform — our app sits at the top

  • Linux Kernel — drivers, memory management, processes
Week 2 Monday: Android Platform & Android Studio
CS 3180 Mobile Application Development

The Android Stack

  • Linux Kernel — drivers, memory management, processes
  • Hardware Abstraction Layer (HAL) — standardizes hardware access
Week 2 Monday: Android Platform & Android Studio
CS 3180 Mobile Application Development

The Android Stack

  • Linux Kernel — drivers, memory management, processes
  • Hardware Abstraction Layer (HAL) — standardizes hardware access
  • Native Libraries (C/C++) — graphics, media, database engine
Week 2 Monday: Android Platform & Android Studio
CS 3180 Mobile Application Development

The Android Stack

  • Linux Kernel — drivers, memory management, processes
  • Hardware Abstraction Layer (HAL) — standardizes hardware access
  • Native Libraries (C/C++) — graphics, media, database engine
  • Android Runtime (ART) — compiles and runs your Kotlin/Java code
Week 2 Monday: Android Platform & Android Studio
CS 3180 Mobile Application Development

The Android Stack

  • Linux Kernel — drivers, memory management, processes
  • Hardware Abstraction Layer (HAL) — standardizes hardware access
  • Native Libraries (C/C++) — graphics, media, database engine
  • Android Runtime (ART) — compiles and runs your Kotlin/Java code
  • Java API Framework — Activity, Compose, Room, Navigation…
Week 2 Monday: Android Platform & Android Studio
CS 3180 Mobile Application Development

The Android Stack

  • Linux Kernel — drivers, memory management, processes
  • Hardware Abstraction Layer (HAL) — standardizes hardware access
  • Native Libraries (C/C++) — graphics, media, database engine
  • Android Runtime (ART) — compiles and runs your Kotlin/Java code
  • Java API Framework — Activity, Compose, Room, Navigation…
  • Our AppCharityGolfTracker lives here
Week 2 Monday: Android Platform & Android Studio
CS 3180 Mobile Application Development

What's Inside Our APK?

An APK file is just a ZIP archive — you can literally unzip it

  • AndroidManifest.xml — declares app to Android (permissions, activities)
  • classes.dex — our Kotlin code compiled for ART
  • res/ — images, layouts, string resources
  • lib/ — native libraries (if any)
  • assets/ — raw files (course layout data, fonts)
Week 2 Monday: Android Platform & Android Studio
CS 3180 Mobile Application Development

Android Versions: Why Maria Cares

Maria surveyed her volunteers:

20%  Android 10   (API 29)   — older phones
40%  Android 12-13 (API 31-33) — mid-range
40%  Android 14   (API 34)   — recent phones

Our strategy in build.gradle.kts:

minSdk = 24     // covers 99%+ of Android devices
targetSdk = 34  // enables latest features and security
Week 2 Monday: Android Platform & Android Studio
CS 3180 Mobile Application Development

Activity Lifecycle

What happens when a volunteer takes a phone call mid-scoring?

Created → Started → Resumed
                       ↓ (call comes in)
                    Paused
                       ↓ (returns to app)
                    Resumed
                       ↓ (navigates away)
                    Stopped → Destroyed

Scores must survive interruptions — this drives architecture decisions

Week 2 Monday: Android Platform & Android Studio
CS 3180 Mobile Application Development

Android Studio Interface Tour

Week 2 Monday: Android Platform & Android Studio
CS 3180 Mobile Application Development

Key Windows in Android Studio

  • Project view — navigate files (Android view vs. Project view)
Week 2 Monday: Android Platform & Android Studio
CS 3180 Mobile Application Development

Key Windows in Android Studio

  • Project view — navigate files (Android view vs. Project view)
  • Editor + Compose Preview — code and live UI side by side
Week 2 Monday: Android Platform & Android Studio
CS 3180 Mobile Application Development

Key Windows in Android Studio

  • Project view — navigate files (Android view vs. Project view)
  • Editor + Compose Preview — code and live UI side by side
  • Logcat — runtime output and crash reports
Week 2 Monday: Android Platform & Android Studio
CS 3180 Mobile Application Development

Key Windows in Android Studio

  • Project view — navigate files (Android view vs. Project view)
  • Editor + Compose Preview — code and live UI side by side
  • Logcat — runtime output and crash reports
  • Device Manager — create and manage emulators
  • Terminal — Git commands, Gradle tasks
Week 2 Monday: Android Platform & Android Studio
CS 3180 Mobile Application Development

Keyboard Shortcuts: The Pro's Advantage

Shortcut Action Golf App Use
Cmd/Ctrl + B Go to declaration Jump to GolfPlayer class
Cmd/Ctrl + Space Code completion Auto-complete team.players
Double Shift Search everywhere Find "leaderboard" in project
Shift + F10 Run app Quick test on emulator
Alt + Enter Quick fix Fix missing imports
Cmd/Ctrl + D Duplicate line Copy score entry row
Cmd/Ctrl + / Comment toggle Disable a feature temporarily
Week 2 Monday: Android Platform & Android Studio
CS 3180 Mobile Application Development

Shortcut Speed Run Activity (5 min)

Race to complete these using only the keyboard:

  1. Open MainActivity.ktDouble Shift → type "main"
  2. Find all uses of GolfPlayerCmd/Ctrl + Shift + F
  3. Go to GolfPlayer definition — Cmd/Ctrl + B
  4. Add a comment to the handicap property — Cmd/Ctrl + /
Week 2 Monday: Android Platform & Android Studio
CS 3180 Mobile Application Development

Gradle Build System

Week 2 Monday: Android Platform & Android Studio
CS 3180 Mobile Application Development

What Is Gradle?

Gradle is the build automation tool for Android

  • Downloads libraries (Compose, Room, Retrofit…)
  • Compiles Kotlin → DEX bytecode
  • Packages everything into an APK
  • Handles different build variants (debug vs. release)

Rule: when Gradle is happy, everything works

Week 2 Monday: Android Platform & Android Studio
CS 3180 Mobile Application Development

CharityGolfTracker build.gradle.kts

android {
    namespace = "com.yourname.charitygolftracker"
    compileSdk = 34        // Build with latest SDK

    defaultConfig {
        applicationId = "org.hopefoundation.golftracker"
        minSdk = 24        // Oldest devices we support
        targetSdk = 34     // Latest features enabled
        versionCode = 1
        versionName = "1.0.0"
    }

    buildFeatures {
        compose = true     // Enable Jetpack Compose
    }
}
Week 2 Monday: Android Platform & Android Studio
CS 3180 Mobile Application Development

Managing Dependencies

dependencies {
    // Core Android
    implementation("androidx.core:core-ktx:1.12.0")

    // Compose UI
    implementation("androidx.compose.ui:ui:1.5.4")
    implementation("androidx.compose.material3:material3:1.2.0")

    // Coming soon: Room for offline scores, Retrofit for API
}
  • implementation — needed at runtime
  • Coordinates: group:artifact:version
  • When we add Room in Week 9: add one line here
Week 2 Monday: Android Platform & Android Studio
CS 3180 Mobile Application Development

AI Tip: Decoding Gradle Errors

Gradle errors can look scary. Use AI to decode them:

I'm getting this Gradle error in Android Studio:

[paste the full error message here]

What does it mean and how do I fix it?

But: understand the fix before applying it — the exam will ask you why

Week 2 Monday: Android Platform & Android Studio
CS 3180 Mobile Application Development

Project Structure for CharityGolfTracker

Week 2 Monday: Android Platform & Android Studio
CS 3180 Mobile Application Development

Package Organization

com.yourname.charitygolftracker/
├── data/
│   ├── model/        # GolfPlayer, Team, HoleScore
│   ├── repository/   # Data access (Week 9)
│   └── remote/       # API calls (Week 11)
├── ui/
│   ├── screens/      # Full-screen composables
│   ├── components/   # Reusable UI pieces
│   └── theme/        # Colors, typography
├── viewmodel/        # Business logic (Week 5)
└── util/             # Helper functions
Week 2 Monday: Android Platform & Android Studio
CS 3180 Mobile Application Development

Why Package Structure Matters

  • Multiple developers can work on data/ and ui/ simultaneously
  • Easy to find files: "score display issue → look in ui/screens/"
  • Preview of professional Android architecture (MVVM)
  • Hope Foundation handoff: clear structure helps future maintainers
Week 2 Monday: Android Platform & Android Studio
CS 3180 Mobile Application Development

Week 2 Monday Recap

Topic Key Takeaway
Android Stack Our code lives at the top; Framework APIs do the heavy lifting
APK A ZIP file containing code, resources, and manifest
API Levels minSdk = 24 covers Maria's volunteers; targetSdk = 34 enables modern features
Activity Lifecycle Interruptions happen — architecture must handle them
Android Studio Learn the shortcuts; master the windows
Gradle Manages dependencies and builds the APK
Week 2 Monday: Android Platform & Android Studio
CS 3180 Mobile Application Development

Wednesday: Android Studio Deep Dive

Debugging tools · Logcat · Breakpoints · Physical devices

Before Wednesday: read zyBook Ch. 2 sections 2.1–2.3

Week 2 Monday: Android Platform & Android Studio

SPEAKER NOTES: Welcome to Week 2. This week we go under the hood — not to become system engineers, but to become confident developers. By end of today students will understand what's inside an APK, how Gradle configures their project, and how to navigate Android Studio efficiently. All of it connects to Maria's challenge: building a golf scoring app that works on five-year-old phones without WiFi.

SPEAKER NOTES: Reinforce the client narrative. Maria's insight about poor WiFi is the design constraint that drives offline-first thinking. The device diversity is the constraint that drives minSdk decisions and compatibility testing. Both are real engineering problems, not hypotheticals.

SPEAKER NOTES: Before we write a single line of code, we need a mental model of the platform we're building on. This isn't a systems course — we won't go deep. The goal is to understand which layer our code lives in and what services we're calling when we use Compose, Navigation, and Room.

SPEAKER NOTES: Start from the bottom. The kernel is the foundation — students don't interact with it directly but it's why Android can run on so many different chips and hardware configurations. Every layer above it is an abstraction.

SPEAKER NOTES: The HAL is why app developers don't care whether the GPS chip is made by Qualcomm or MediaTek. It's a contract layer. Ask: what hardware will the golf app eventually use? GPS for course location, camera for team photos.

SPEAKER NOTES: SQLite lives here — the database engine that Room (our persistence library coming in Week 9) sits on top of. Students don't call C++ directly, but their Room queries ultimately execute C++ code.

SPEAKER NOTES: ART replaced Dalvik as of Android 5.0. The key point: our Kotlin code compiles to DEX bytecode, which ART runs. Ahead-of-time compilation in ART is why Android apps feel faster than they used to. No need for deep detail here.

SPEAKER NOTES: This is the layer we interact with most. Every API call — composables, lifecycle callbacks, database operations — goes through the Java API Framework. "Java API" doesn't mean we write Java: Kotlin compiles to the same bytecode and calls the same APIs seamlessly.

SPEAKER NOTES: Our app is a first-class citizen at the top of this stack — same layer as Google Maps and Gmail. We call Framework APIs, which talk to system services, which eventually reach the hardware. Key takeaway: understanding the layers helps you know where to look when something goes wrong.

SPEAKER NOTES: If time permits, live demo: rename CharityGolfTracker.apk to .zip and open it in Finder/Explorer. Students are always surprised it's just a folder. This demystifies the build process — Gradle assembles these pieces. The manifest declaring permissions will matter when we add camera access for team photos.

SPEAKER NOTES: minSdk = 24 (Android 7.0) gives us access to modern APIs while covering essentially everyone. targetSdk = 34 tells Android "this app has been tested against the latest behavior changes." We'll set this today. Connect the percentages back to real people — that 20% on Android 10 includes some of Maria's most dedicated volunteers.

SPEAKER NOTES: This is a brief intro — we'll spend a full week on lifecycle later. The golf context makes it concrete: a volunteer enters 3 of 9 holes, gets a call, returns. Did we lose the data? That depends on how we manage state. ViewModel (Week 5) and rememberSaveable solve this problem. Plant the seed now.

SPEAKER NOTES: Now the practical stuff. Students will spend hundreds of hours in Android Studio this semester. Ten minutes learning the interface today saves hours of frustration later. This is also prep for the demo session on Wednesday.

SPEAKER NOTES: Android view is the default and hides build files — cleaner for day-to-day work. Project view shows everything on disk — useful when you need to find a file Gradle created. Demo the toggle if Android Studio is open.

SPEAKER NOTES: The split view is transformative for UI development. Show the @Preview annotation and interactive preview mode — you can click buttons in the preview without running the app. This is one of Compose's biggest productivity advantages.

SPEAKER NOTES: Logcat is the developer's window into a running app. We'll use it heavily on Wednesday. Emphasize filtering by package name — otherwise you see every log from every process on the device.

SPEAKER NOTES: Device Manager is where we create AVDs. Students should have one from Week 1 — if not, five minutes after class fixes that. The integrated terminal means you never need to leave Android Studio for Git work.

SPEAKER NOTES: Distribute or point to the keyboard shortcut cheat sheet. Run the "Shortcut Speed Run" activity: students race to complete four tasks using only the keyboard. Goal: 10 minutes learning shortcuts = hours saved over the semester. The golf-specific use cases make each shortcut memorable.

SPEAKER NOTES: Give students 4 minutes, then review together. Competitive energy makes this memorable. Common stumble: using menu items instead of shortcuts. Gently redirect: "hands off the mouse." Students who finish early can explore Cmd+E (recent files) or Cmd+Shift+A (find action).

SPEAKER NOTES: Gradle is the engine that turns source code into a running app. Students don't need to master Gradle — they need to understand enough to configure it correctly and not panic when it produces an error. The golf context: Gradle is how we set minSdk to cover Maria's old phones.

SPEAKER NOTES: Analogy: Gradle is like a very smart recipe book. It knows all the ingredients (dependencies) and the exact steps to assemble them into a finished app. When an ingredient is missing or two ingredients conflict, the build fails with an error — our job is to read that error and fix the recipe.

SPEAKER NOTES: Walk through each field. applicationId is the unique identifier on the Play Store — it never changes after publishing. The minSdk/targetSdk pair we discussed earlier. versionCode increments on every release (integer, used internally); versionName is what users see. buildFeatures.compose = true enables the Compose compiler plugin.

SPEAKER NOTES: Maven coordinates are the universal address for a library. group = the organization, artifact = the library name, version = the specific release. Students will add dependencies throughout the semester — each time they add a library for the golf app, they modify this block. Gradle sync downloads it automatically.

SPEAKER NOTES: Reinforce the Generate → Understand → Adapt policy. Gradle errors often have cryptic messages that become clear once you know what to look for. Pasting the full error (not a screenshot!) into Claude gives context for a useful explanation. Common errors: version conflicts, missing repositories, kotlin version mismatches.

SPEAKER NOTES: We'll end today by looking at how to organize the project as it grows. Students don't need to reorganize anything now — this is awareness and preview. The structure mirrors the MVVM architecture we'll build toward over the semester.

SPEAKER NOTES: This is the MVVM architecture in folder form. data/ is the model layer, ui/ is the view layer, viewmodel/ is the bridge. Students see this structure at every Android job. No action required now — when we build features in later weeks, we'll put files in the right place. The weeks-ahead pointers (Week 5, 9, 11) show the roadmap.

SPEAKER NOTES: Connect structure to the team project. When students work in groups (starting Week 12), clear package boundaries prevent merge conflicts and confusion. Also: if Hope Foundation ever hands this to a contractor to maintain, clean structure reduces onboarding time dramatically.

SPEAKER NOTES: Quick review before dismissal. These six topics are the foundation for everything that follows. Students shaky on Gradle or the lifecycle should read zyBook Chapter 2, sections 2.1–2.3 before Wednesday.

SPEAKER NOTES: Close with anticipation. Wednesday we get hands-on with the debugging workflow — the single skill that separates productive developers from frustrated ones. If students have an Android phone, bring it to Wednesday's session for the physical device demo.