Android Studio Setup
This guide will help you set up your Android development environment. We'll install Android Studio and configure it for the MediLink project.
Installing Android Studio
-
Download Android Studio
- Visit developer.android.com/studio
- Click "Download Android Studio"
- Choose the appropriate version for your operating system
-
Install Android Studio
- Windows: Run the downloaded
.exe
file - macOS: Open the
.dmg
file and drag Android Studio to Applications - Linux: Extract the downloaded file and run
studio.sh
- Windows: Run the downloaded
Note: Make sure you have at least 8GB of RAM and 8GB of free disk space.
First Launch Setup
-
Welcome Screen
- Click "Next" to start the setup wizard
- Choose "Standard" installation type
- Select your UI theme (Light or Dark)
-
SDK Components
- Android SDK
- Android SDK Platform
- Android Virtual Device (AVD)
Tip: The download might take some time depending on your internet connection.
Creating Your First Project
-
New Project
- Click "New Project"
- Select "Empty Activity"
- Click "Next"
-
Configure Project
Name: MediLink Package name: com.example.medilink Save location: Choose your preferred location Language: Kotlin Minimum SDK: API 24 (Android 7.0)
-
Project Structure
app/ ├── manifests/ ├── java/ │ └── com.example.medilink/ │ ├── MainActivity.kt │ └── ui/ └── res/ ├── drawable/ ├── layout/ ├── mipmap/ └── values/
Configuring Gradle
-
Project-level build.gradle
buildscript { ext { compose_version = '1.4.0' kotlin_version = '1.8.0' } }
-
App-level build.gradle
plugins { id 'com.android.application' id 'kotlin-android' } android { compileSdk 33 defaultConfig { applicationId "com.example.medilink" minSdk 24 targetSdk 33 versionCode 1 versionName "1.0" } } dependencies { implementation "androidx.compose.ui:ui:$compose_version" implementation "androidx.compose.material:material:$compose_version" implementation "androidx.compose.ui:ui-tooling-preview:$compose_version" implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1" implementation "androidx.navigation:navigation-compose:2.5.3" }
Setting Up Git
-
Initialize Git Repository
git init
-
Create .gitignore
*.iml .gradle /local.properties /.idea /build /captures .externalNativeBuild .cxx
-
Initial Commit
git add . git commit -m "Initial commit: Project setup"
Testing Your Setup
-
Create an Android Virtual Device (AVD)
- Click "Tools" > "Device Manager"
- Click "Create Virtual Device"
- Select a phone definition (e.g., Pixel 4)
- Download and select a system image (e.g., API 33)
- Complete the AVD creation
-
Run the App
- Click the "Run" button (green play icon)
- Select your AVD
- Wait for the app to build and launch
Warning: The first build might take several minutes as Gradle downloads dependencies.
Next Steps
- Learn Kotlin Basics
- Understand Android Project Structure
- Start with Jetpack Compose
Troubleshooting
Common issues and solutions:
-
Gradle Sync Failed
- Check internet connection
- Update Android Studio
- Invalidate caches (File > Invalidate Caches)
-
Emulator Not Starting
- Enable virtualization in BIOS
- Update graphics drivers
- Try a different system image
-
Build Errors
- Clean project (Build > Clean Project)
- Rebuild project (Build > Rebuild Project)
- Check SDK installation
Tip: Keep Android Studio and SDK tools updated for the best development experience.