Introduction
Welcome to your first Android application! In this tutorial, we’ll walk through creating a simple “Hello World” app in Android Studio. This is the foundation for all Android development and will introduce you to the basic structure of an Android project.
Prerequisites
Before starting this tutorial, make sure you have:
- Android Studio installed (see Android Studio Setup)
- A virtual device (AVD) or physical Android device ready for testing
- Basic understanding of Java or Kotlin programming
Video Tutorial
Follow along with this step-by-step video guide:
infoWatch the video for a complete walkthrough, then use the written instructions below as a reference!
Creating a New Project
Launch Android Studio
- Open Android Studio
- From the welcome screen, click New Project
- If you already have a project open, go to File → New → New Project
Select Project Template
- In the “New Project” window, select Empty Activity
- Click Next
infoThe Empty Activity template provides a basic activity with minimal code, perfect for learning.
Configure Your Project
Fill in the following details:
- Name: HelloWorld
- Package name: com.example.helloworld
- Save location: Choose your preferred directory
- Language: Java or Kotlin (your choice)
- Minimum SDK: API 21 (Android 5.0)
Click Finish when done.
Wait for Gradle Build
Android Studio will now:
- Create your project structure
- Download necessary dependencies
- Build your project
This may take a few minutes on first run.
Understanding the Project Structure
Key Files and Folders
Project Components
- app/src/main/java/ - Contains your Java/Kotlin code
- app/src/main/res/ - Contains all resources (layouts, images, strings)
- app/src/main/AndroidManifest.xml - App configuration and permissions
- build.gradle - Build configuration files
MainActivity
// Java version - Placeholder
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
// Kotlin version - Placeholder
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
}
Layout XML
<!-- activity_main.xml - Placeholder -->
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
android:textSize="24sp" />
</androidx.constraintlayout.widget.ConstraintLayout>
Running Your App
Select Your Device
- Click the device dropdown in the toolbar
- Select your virtual device or connected physical device
Run the Application
- Click the Run button (green play icon) or press Shift + F10
- Wait for the app to build and deploy
- The app will launch on your selected device
View the Result
You should see “Hello World!” displayed on the screen!
Customizing Your Hello World App
Changing the Text
Detailed instructions coming soon from YouTube video transcription
Adding Colors
Detailed instructions coming soon from YouTube video transcription
Common Issues and Solutions
-
Build fails with “SDK not found” chevron_right
Make sure you have installed the Android SDK through the SDK Manager. Go to Tools → SDK Manager and ensure the latest SDK is installed.
-
App crashes immediately on launch chevron_right
Check the Logcat window for error messages. Common causes include:
- Incorrect minimum SDK version
- Missing permissions in AndroidManifest.xml
- Syntax errors in layout XML
-
Emulator won’t start chevron_right
Refer to the Android Studio Setup troubleshooting section for emulator issues.
Next Steps
After completing your first Hello World app, you can:
- Modify the UI - Change colors, fonts, and layouts
- Add user interaction - Implement buttons and click listeners
- Learn about Activities - Understand the Android lifecycle
- Explore Views and Layouts - Build more complex interfaces
- Add tests - Add tests for your code
Additional Resources
infoPractice by creating variations of this app - try different text, colors, and layouts to get comfortable with Android Studio!