Search code examples
androidkotlinandroid-studiomobilekotlin-android

8 issues when i create a basic view project kotlin on the android studio


`8 issues were found when checking AAR metadata:

  1. Dependency 'androidx.navigation:navigation-fragment:2.7.1' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs.

    :app is currently compiled against android-33.

    Also, the maximum recommended compile SDK version for Android Gradle plugin 8.0.2 is 33.

    Recommended action: Update this project's version of the Android Gradle plugin to one that supports 34, then update this project to use compileSdk of at least 34.

    Note that updating a library or application's compileSdk (which allows newer APIs to be used) can be done separately from updating targetSdk (which opts the app in to new runtime behavior) and minSdk (which determines which devices the app can be installed on).

  2. Dependency 'androidx.navigation:navigation-runtime-ktx:2.7.1' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs.

    :app is currently compiled against android-33.

    Also, the maximum recommended compile SDK version for Android Gradle plugin 8.0.2 is 33.

    Recommended action: Update this project's version of the Android Gradle plugin to one that supports 34, then update this project to use compileSdk of at least 34.

    Note that updating a library or application's compileSdk (which allows newer APIs to be used) can be done separately from updating targetSdk (which opts the app in to new runtime behavior) and minSdk (which determines which devices the app can be installed on).

  3. Dependency 'androidx.navigation:navigation-ui:2.7.1' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs.

    :app is currently compiled against android-33.

    Also, the maximum recommended compile SDK version for Android Gradle plugin 8.0.2 is 33.

    Recommended action: Update this project's version of the Android Gradle plugin to one that supports 34, then update this project to use compileSdk of at least 34.

    Note that updating a library or application's compileSdk (which allows newer APIs to be used) can be done separately from updating targetSdk (which opts the app in to new runtime behavior) and minSdk (which determines which devices the app can be installed on).

  4. Dependency 'androidx.navigation:navigation-runtime:2.7.1' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs.

    :app is currently compiled against android-33.

    Also, the maximum recommended compile SDK version for Android Gradle plugin 8.0.2 is 33.

    Recommended action: Update this project's version of the Android Gradle plugin to one that supports 34, then update this project to use compileSdk of at least 34.

    Note that updating a library or application's compileSdk (which allows newer APIs to be used) can be done separately from updating targetSdk (which opts the app in to new runtime behavior) and minSdk (which determines which devices the app can be installed on).

  5. Dependency 'androidx.navigation:navigation-common-ktx:2.7.1' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs.

    :app is currently compiled against android-33.

    Also, the maximum recommended compile SDK version for Android Gradle plugin 8.0.2 is 33.

    Recommended action: Update this project's version of the Android Gradle plugin to one that supports 34, then update this project to use compileSdk of at least 34.

    Note that updating a library or application's compileSdk (which allows newer APIs to be used) can be done separately from updating targetSdk (which opts the app in to new runtime behavior) and minSdk (which determines which devices the app can be installed on).

  6. Dependency 'androidx.navigation:navigation-ui-ktx:2.7.1' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs.

    :app is currently compiled against android-33.

    Also, the maximum recommended compile SDK version for Android Gradle plugin 8.0.2 is 33.

    Recommended action: Update this project's version of the Android Gradle plugin to one that supports 34, then update this project to use compileSdk of at least 34.

    Note that updating a library or application's compileSdk (which allows newer APIs to be used) can be done separately from updating targetSdk (which opts the app in to new runtime behavior) and minSdk (which determines which devices the app can be installed on).

  7. Dependency 'androidx.navigation:navigation-fragment-ktx:2.7.1' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs.

    :app is currently compiled against android-33.

    Also, the maximum recommended compile SDK version for Android Gradle plugin 8.0.2 is 33.

    Recommended action: Update this project's version of the Android Gradle plugin to one that supports 34, then update this project to use compileSdk of at least 34.

    Note that updating a library or application's compileSdk (which allows newer APIs to be used) can be done separately from updating targetSdk (which opts the app in to new runtime behavior) and minSdk (which determines which devices the app can be installed on).

  8. Dependency 'androidx.navigation:navigation-common:2.7.1' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs.

    :app is currently compiled against android-33.

    Also, the maximum recommended compile SDK version for Android Gradle plugin 8.0.2 is 33.

    Recommended action: Update this project's version of the Android Gradle plugin to one that supports 34, then update this project to use compileSdk of at least 34.

    Note that updating a library or application's compileSdk (which allows newer APIs to be used) can be done separately from updating targetSdk (which opts the app in to new runtime behavior) and minSdk (which determines which devices the app can be installed on).`

I create a basic view project, i try to run, and this error is showed in the console.

it's my first experience with kotlin


Solution

  • You simply need to upgrade the app compile version from 33 to 34 because latest version of different components like fragments require api level 34.

    So for api level 34 you will need to upgrade some files after that your app will compile.

    Here is my code you need to replace it with yours then no error will come. In android paste this and also change the app name with yours in place of tweetsy:

    android {
    namespace = "com.example.tweetsy"
    compileSdk = 34
    
    defaultConfig {
        applicationId = "com.example.tweetsy"
        minSdk = 24
        targetSdk = 34
        versionCode = 1
        versionName = "1.0"
    
        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables {
            useSupportLibrary = true
        }
    }
    
    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
    }
    composeOptions {
        kotlinCompilerExtensionVersion = "1.4.3"
    }
    packaging {
        resources {
            excludes += "/META-INF/{AL2.0,LGPL2.1}"
          }
       }
     }
    

    All othe code will same in build.gradle file