Skip to main content

Quickstart Guide

Get the Space Flight News app running on your Android device or emulator in just a few steps.

Prerequisites

Before you begin, ensure you have the following installed:
  • Android Studio (Arctic Fox or newer recommended)
  • JDK 11 or higher
  • Android SDK with API level 24-35
  • Git for cloning the repository
The app requires minimum SDK 24 (Android 7.0) and targets SDK 34.

Step 1: Clone the Repository

1

Clone the project

Open your terminal and clone the repository:
git clone https://github.com/yourusername/space-flight-news.git
cd space-flight-news
2

Open in Android Studio

Launch Android Studio and select File > Open, then navigate to the cloned directory.Android Studio will automatically start syncing Gradle files.

Step 2: Configure Build Environment

The project uses Kotlin DSL for Gradle configuration. No additional setup is required - the build configuration is already optimized:
build.gradle.kts
android {
    namespace = "com.bsvillarraga.spaceflightnews"
    compileSdk = 35
    
    defaultConfig {
        applicationId = "com.bsvillarraga.spaceflightnews"
        minSdk = 24
        targetSdk = 34
        versionCode = 1
        versionName = "1.0"
    }
    
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_11
        targetCompatibility = JavaVersion.VERSION_11
    }
    
    kotlinOptions {
        jvmTarget = "11"
    }
}
Make sure your Android Studio is using JDK 11. You can verify this in File > Project Structure > SDK Location.

Step 3: Sync Dependencies

The app uses several key dependencies that will be downloaded automatically:
  • Dagger Hilt for dependency injection
  • Retrofit for API calls
  • Room for local database
  • Jetpack Navigation for screen navigation
  • Glide for image loading
  • Coroutines for asynchronous operations
Wait for Gradle to finish syncing. This may take a few minutes on the first run.

Step 4: Set Up an Android Device

Choose one of the following options:

Using a Physical Device

  1. Enable Developer Options on your Android device:
    • Go to Settings > About Phone
    • Tap Build Number 7 times
  2. Enable USB Debugging:
    • Go to Settings > Developer Options
    • Toggle on USB Debugging
  3. Connect your device via USB
  4. Accept the debugging authorization prompt on your device

Step 5: Run the App

1

Build the project

Click the Build menu and select Make Project, or use the shortcut:
Ctrl+F9 (Windows/Linux)
Cmd+F9 (Mac)
2

Run the app

Click the Run button (green play icon) or use:
Shift+F10 (Windows/Linux)
Ctrl+R (Mac)
Select your target device when prompted.
3

Wait for installation

Android Studio will build, install, and launch the app on your selected device.You should see the articles list screen with the latest space news!

Verify Installation

Once the app launches, you should see:
  1. A list of space flight news articles with images
  2. A search icon in the toolbar
  3. Pull-down to refresh functionality
  4. Infinite scroll - new articles load as you scroll down
If you see articles loading, congratulations! The app is running successfully.

App Components at Startup

Application Class

The app starts with the MyApp class annotated with @HiltAndroidApp:
MyApp.kt
@HiltAndroidApp
class MyApp: Application()
This initializes Dagger Hilt for dependency injection throughout the app.

Dependency Injection

Hilt automatically provides dependencies like the Retrofit client:
NetworkModule.kt
@Provides
@Singleton
fun provideRetrofit(): Retrofit {
    return Retrofit.Builder()
        .baseUrl("https://api.spaceflightnewsapi.net/")
        .client(client)
        .addConverterFactory(GsonConverterFactory.create())
        .build()
}

@Provides
@Singleton
fun provideArticlesApiClient(retrofit: Retrofit): ArticlesApiClient =
    retrofit.create(ArticlesApiClient::class.java)

Main Activity

The single activity hosts all fragments using Jetpack Navigation:
AndroidManifest.xml
<activity
    android:name=".presentation.ui.MainActivity"
    android:exported="true">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

Required Permissions

The app requests these permissions at runtime:
AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
  • INTERNET: Required for fetching articles from the API
  • ACCESS_NETWORK_STATE: Checks network availability
  • RECORD_AUDIO: Enables voice search functionality
  • POST_NOTIFICATIONS: Allows the app to send notifications

Troubleshooting

Ensure Android Studio is using JDK 11:
  1. Go to File > Project Structure
  2. Under SDK Location, set Gradle JDK to version 11 or higher
  3. Click Apply and rebuild
Check the Logcat output for error messages:
  1. Open Logcat in Android Studio (View > Tool Windows > Logcat)
  2. Filter by your app’s package name
  3. Look for red error messages or stack traces
Common issues:
  • Missing internet permission (should be granted automatically)
  • API connectivity issues (check your device’s internet connection)
This could be due to:
  1. No internet connection: Check your device/emulator has internet access
  2. API issues: The Space Flight News API might be temporarily unavailable
  3. Network error: Check Logcat for network-related errors
Try:
  • Pull down to refresh
  • Check the device’s internet connection
  • Restart the app
  1. Click File > Invalidate Caches and restart
  2. Delete .gradle folder in project root
  3. Click File > Sync Project with Gradle Files
  4. If issues persist, update Gradle wrapper:
./gradlew wrapper --gradle-version=8.0

Next Steps

Now that you have the app running, explore these topics:

Architecture

Deep dive into the clean architecture implementation

Core Features

Explore article list, search, and pagination features

API Reference

Explore the repository and API client documentation

Data Layer

Learn about data management and persistence

Running Tests

The project includes unit and instrumented tests. Run them with:
# Unit tests
./gradlew test

# Instrumented tests (requires connected device/emulator)
./gradlew connectedAndroidTest
The project uses JUnit 5, MockK, and Turbine for testing. Check the test files for examples.

Build docs developers (and LLMs) love