Setting Up Android Studio & Your First App
What is Android Studio?
Android Studio is the official tool (an IDE — Integrated Development Environment) for building Android apps. It bundles everything you need: a code editor, the Android SDK (the libraries and tools), an emulator to test on a virtual phone, and the Gradle build system that turns your code into an installable app.
Installing it
- Download Android Studio from the official Android developer website.
- Run the installer and accept the default components (this includes the SDK and an emulator image).
- Open it once and let it finish downloading the SDK — this can take a few minutes.
Creating your first project
- Click New Project.
- Choose Empty Views Activity (XML-based) for this course.
- Set a Name (e.g. “MyFirstApp”), a package name (like
com.yourname.myfirstapp, a unique ID for your app), and language Kotlin. - Pick a Minimum SDK — this is the oldest Android version you support. API 24 (Android 7.0) is a safe choice that still reaches almost every device.
- Click Finish and wait for Gradle to build.
Running the app
You have two options:
- Emulator — open Device Manager, create a virtual phone, then press the green ▶ Run button.
- Real device (faster) — on your phone, enable Developer Options (tap “Build number” 7 times in Settings), turn on USB debugging, plug it in, and press Run.
What the starter code does
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
}
Line by line: MainActivity is your first screen. onCreate runs when the screen is created. setContentView(R.layout.activity_main) tells Android to draw the layout file activity_main.xml. R is an auto-generated class that gives every resource a unique ID.
Changing something
Open res/layout/activity_main.xml, find the TextView, and change its text:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Welcome to my first app!" />
Press Run again and watch it update on the device.
Common setup problems
- “SDK not found” — open SDK Manager and install the latest SDK platform.
- Emulator is slow — enable hardware acceleration, or just use a real phone.
- Gradle sync failed — check your internet; Gradle downloads dependencies the first time.
Summary: Android Studio + the SDK + an emulator or phone is all you need.onCreate+setContentViewdraws your first screen. Run early and often.