1. Development Environment Prerequisites
Before writing code, ensure your workstation meets modern Android SDK requirements:
- JDK 17 or JDK 21: Modern Gradle 8.x+ requires Java Development Kit 17+.
- Android Studio (Latest Stable): Download the official IDE from developer.android.com.
- Android SDK Platforms: Install API 34 (Android 14) and API 35 (Android 15) via the SDK Manager.
- Hardware Acceleration (HAXM / Hyper-V): Enabled in your computer's BIOS for smooth emulator execution.
2. Creating Your First Project
Launch Android Studio and select New Project ā Empty Activity (Compose). Provide the project metadata:
- Name:
JmdFirstApp - Package Name:
in.jmdworld.firstapp - Language: Kotlin
- Minimum SDK: API 24 (Android 7.0 - Nougat) for 99%+ global device reach.
3. Understanding Modern Declarative UI with Jetpack Compose
Unlike legacy Android development which relied on verbose XML layout files, modern Android uses Composable functions to define UI directly in Kotlin. Here is an interactive counter application demonstrating state management:
package in.jmdworld.firstapp
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.*
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
MaterialTheme {
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
CounterScreen()
}
}
}
}
}
@Composable
fun CounterScreen() {
// State holder preserved during recomposition
var count by remember { mutableIntStateOf(0) }
Column(
modifier = Modifier
.fillMaxSize()
.padding(24.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
Text(
text = "JMD WORLD Engineering",
fontSize = 24.sp,
style = MaterialTheme.typography.headlineMedium
)
Spacer(modifier = Modifier.height(16.dp))
Text(
text = "Click Count: $count",
fontSize = 32.sp,
style = MaterialTheme.typography.displaySmall
)
Spacer(modifier = Modifier.height(24.dp))
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
Button(onClick = { count++ }) {
Text("Increment (+)")
}
OutlinedButton(onClick = { count = 0 }) {
Text("Reset")
}
}
}
}
4. Testing on a Real Physical Device
While emulators are convenient, nothing matches physical hardware testing:
- On your Android phone, navigate to Settings ā About Phone.
- Tap Build Number seven times consecutively until you see "You are now a developer!"
- Go to System ā Developer Options and toggle on USB Debugging.
- Connect your phone via USB, allow debugging prompt on your screen, and hit Run (Shift + F10) in Android Studio.
5. Building Your Release APK & AAB
When ready to share your application or publish to the Google Play Store:
- Navigate to Build ā Generate Signed Bundle / APK.
- Select Android App Bundle (.aab) for Play Store or APK for direct sideloading.
- Create a secure production Keystore (
.jks) and store the password safely.
Summary
Building your first Android application is the foundational milestone in mobile engineering. With modern Kotlin and Jetpack Compose, the barrier to entry has never been lower. Start with small, focused features, practice clean architecture, and iterate constantly.
Comments (0)
No comments yet. Share your thoughts below!
Leave a Comment
Share your thoughts or questions. Your email address remains private.