Rayner Ngure
Rayner Ngure

Reputation: 1

How do I switch from SDK version 35 for android 15 to one that is able to handle android 13 that is SDK version 33. I can't seem to get it

I have been trying to run an app am creating using android studio...I have been trying to run the code and now all it does is open the force shut and displaying that I should check my SDK version so I changed it to change it from SDK version 35 to SDK version 33 but if I do so it displays and error Update minCompileSdk in modules with dependencies that require a higher minCompileSdk. and when I revert it back to SDK version 35 it doesn't open....how do I handle it.

I have tried updating my SDK version and even my emulator to version 35 and rewriting my dependencies to these also but it still doesn't run, my emulator setting I also made sure it is compatible with my codes and even tried the recommended settings...here is my codes below

plugins {
    alias(libs.plugins.android.application)
    alias(libs.plugins.kotlin.android)
    alias(libs.plugins.kotlin.compose)
    alias(libs.plugins.google.gms.google.services) // ✅ Google Services Plugin
}

android {
    namespace = "com.example.mobile"
    compileSdk = 33 // ✅ Set to Android 13 (API 33)

    defaultConfig {
        applicationId = "com.example.mobile"
        minSdk = 21 // ✅ Keeping at 24 (Android 7.0 Nougat)
        targetSdk = 33 // ✅ Targeting Android 13 (API 33)
        versionCode = 1
        versionName = "1.0"
        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            isMinifyEnabled = false
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
        }
    }

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_17
        targetCompatibility = JavaVersion.VERSION_17
    }
    kotlinOptions {
        jvmTarget = "17"
    }
    buildFeatures {
        compose = true
    }
}

dependencies {
    // Core AndroidX
    implementation(libs.androidx.core.ktx)
    implementation(libs.androidx.lifecycle.runtime.ktx)
    implementation(libs.androidx.activity.compose)
    implementation(platform(libs.androidx.compose.bom))
    implementation(libs.androidx.ui)
    implementation(libs.androidx.ui.graphics)
    implementation(libs.androidx.ui.tooling.preview)
    implementation(libs.androidx.material3)

    // ✅ Material Icons Extended (Required for Visibility and VisibilityOff)
    implementation("androidx.compose.material:material-icons-extended:1.5.0")

    // ✅ Firebase BOM (Bill of Materials)
    implementation(platform("com.google.firebase:firebase-bom:32.2.0"))

    // ✅ Firebase Authentication
    implementation("com.google.firebase:firebase-auth-ktx")

    // ✅ Firebase Core (Optional: Analytics, Crashlytics, etc.)
    implementation("com.google.firebase:firebase-analytics-ktx")

    // ✅ Firebase Firestore (If needed for database)
    implementation("com.google.firebase:firebase-firestore-ktx")

    // ✅ Firebase Realtime Database (If needed)
    implementation("com.google.firebase:firebase-database-ktx")

    // ✅ Firebase Storage (If needed)
    implementation("com.google.firebase:firebase-storage-ktx")

    // ✅ Retrofit for API calls
    implementation("com.squareup.retrofit2:retrofit:2.9.0")
    implementation("com.squareup.retrofit2:converter-gson:2.9.0")

    // ✅ Gson for JSON parsing
    implementation("com.google.code.gson:gson:2.10.1")

    // ✅ Coroutines
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")

    // ✅ ViewModel & LiveData (MVVM)
    implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.7")
    implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.8.7")
    implementation(libs.androidx.espresso.core)

    // ✅ Testing
    testImplementation(libs.junit)
    androidTestImplementation(libs.androidx.junit)
    androidTestImplementation(libs.androidx.espresso.core)
    androidTestImplementation(platform(libs.androidx.compose.bom))
    androidTestImplementation(libs.androidx.ui.test.junit4)
    debugImplementation(libs.androidx.ui.tooling)
    debugImplementation(libs.androidx.ui.test.manifest)
}

// ✅ Apply Google Services at the Bottom
apply(plugin = "com.google.gms.google-services")

Upvotes: 0

Views: 25

Answers (0)

Related Questions