25

Hey guys how can I update to latest version because I cannot find the latest gradle-plugin. Can somone guide me on this?

build.gradle(ExampleApp)

buildscript {
    ext {
        kotlin_version = '1.6.10'
        kotlin_serializtion_version = '1.5.21'
        kotlin_coroutines_version = "1.6.0"
        moshiVersion = "1.13.0"
        retrofit2_version = "2.9.0"
        okhttp3_version = "4.9.0"
        mockk_version = "1.12.2"
        picassoVersion = "2.71828"
        lifecycle_version = "2.5.0"
        koin_version = "3.2.0"
        barcode_scanner_version = "16.1.1"
        camerax_version = "1.0.0"
        camera_view_version = "1.0.0-alpha22"
        stripe_version = "19.1.0"
        jacoco_version = "0.8.7"
        room_version = "2.4.1"
        glide_version = "4.12.0"
        json_version = "20180813"
        kotlin_reflect_version = "1.6.10"
        compose_version = '1.2.0-rc03'
        espresso_version = '3.4.0'
        core_testing_version = '2.1.0'
        pdf_view_version = '3.2.0-beta.1'
        appboy_version = '21.0.0'
        mp_chart_version = "3.1.0"
        activity_compose = "1.5.0"
        compose_material3 = "1.0.0-alpha14"
    }

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.2.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
        classpath 'com.google.gms:google-services:4.3.10'
        classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_serializtion_version"
        classpath 'com.google.firebase:firebase-appdistribution-gradle:3.0.0'
    }
}

plugins {
    id "org.sonarqube" version "3.3"
}
apply from: "${rootDir}/config/sonarqube/sonarqube.gradle"

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven { url 'https://s3.amazonaws.com/salesforcesos.com/android/maven/release' }
        maven { url 'https://mobile-sdk.jumio.com' }
        maven { url "https://appboy.github.io/appboy-android-sdk/sdk" }
        maven { url 'https://jitpack.io' }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip

build.gradle(:app)

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-parcelize'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlinx-serialization'
apply plugin: 'com.google.firebase.appdistribution'

android {
    compileSdkVersion 33

    defaultConfig {
        applicationId "com.example.app"
        minSdkVersion 21
        targetSdkVersion 33
        .....
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_1_8.toString()
    }

    sourceSets {
        test {
            java.srcDirs =
                [
                    "${project.projectDir}/src/test/java"
                ]
        }
    }

    testOptions {
        unitTests.returnDefaultValues = true
    }

    buildFeatures {
        viewBinding true
        compose true
    }

    composeOptions {
        kotlinCompilerExtensionVersion = "1.2.0"
        kotlinCompilerVersion kotlin_version
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'androidx.browser:browser:1.4.0'
    implementation 'androidx.appcompat:appcompat:1.4.2'
    implementation "androidx.fragment:fragment-ktx:1.5.0"
    implementation 'com.google.android.play:core:1.10.3'
    implementation 'com.google.android.material:material:1.5.0'

    // kotlin atomic
    implementation 'org.jetbrains.kotlinx:atomicfu:0.17.1'

    //Kotlin extensions library for Play Core
    implementation 'com.google.android.play:core-ktx:1.8.1'

    //Android Kotlin extensions
    implementation "androidx.core:core-ktx:1.8.0"

    //Unit test
    testImplementation 'junit:junit:4.12'
    testImplementation 'org.mockito:mockito-inline:3.4.0'
    androidTestImplementation 'org.mockito:mockito-android:3.4.0'
    testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
    testImplementation 'androidx.arch.core:core-testing:2.1.0'
    testImplementation "io.mockk:mockk:${mockk_version}"
    testImplementation "org.json:json:$json_version"

    //Moshi (JSON parser)
    implementation "com.squareup.moshi:moshi-kotlin:$moshiVersion"
    kapt "com.squareup.moshi:moshi-kotlin-codegen:$moshiVersion"

    //Retrofit2
    implementation "com.squareup.retrofit2:retrofit:$retrofit2_version"
    implementation "com.squareup.retrofit2:converter-moshi:$retrofit2_version"

    //Paging 3
    implementation "androidx.paging:paging-runtime-ktx:3.1.1"

    //Okhttp3
    implementation "com.squareup.okhttp3:okhttp:$okhttp3_version"
    implementation "com.squareup.okhttp3:logging-interceptor:$okhttp3_version"
    testImplementation "com.squareup.okhttp3:mockwebserver:$okhttp3_version"

    //Kotlin Coroutines
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines_version"
    testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlin_coroutines_version"

    //ViewModel and LiveData
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"

    //HTML parser
    implementation 'org.jsoup:jsoup:1.12.1'

    //Payments
    implementation 'com.google.android.gms:play-services-wallet:19.1.0'
    implementation "com.stripe:stripe-android:$stripe_version"

    //Firebase
    implementation platform('com.google.firebase:firebase-bom:27.1.0')
    implementation 'com.google.firebase:firebase-analytics'
    implementation 'com.google.firebase:firebase-crashlytics-ktx'
    implementation 'com.google.firebase:firebase-config-ktx'
    implementation "com.google.firebase:firebase-messaging"
    implementation "com.google.firebase:firebase-core"

    //Pager indicator
    implementation 'me.relex:circleindicator:2.1.4'

    //Animations
    implementation 'com.airbnb.android:lottie:3.2.2'
    implementation 'pl.bclogic:pulsator4droid:1.0.3'

    //Loading images
    implementation "com.github.bumptech.glide:glide:$glide_version"
    kapt "com.github.bumptech.glide:compiler:$glide_version"

    //View container which can wrap content
    implementation 'com.google.android:flexbox:2.0.1'

    //Phone Authentication
    implementation 'com.google.android.gms:play-services-auth:20.1.0'
    implementation 'com.google.android.gms:play-services-auth-api-phone:18.0.1'
    implementation 'com.googlecode.libphonenumber:libphonenumber:8.7.0'

    //Video player
    implementation 'com.google.android.exoplayer:exoplayer:2.11.3'

    //Dependency injection - Koin AndroidX Scope features
    implementation "io.insert-koin:koin-android:$koin_version"
    implementation "io.insert-koin:koin-androidx-workmanager:$koin_version"
    testImplementation "io.insert-koin:koin-test-junit4:$koin_version"
    testImplementation "io.insert-koin:koin-test:$koin_version"

    //WorkManager
    implementation "androidx.work:work-runtime-ktx:2.7.1"

    // App Startup
    implementation "androidx.startup:startup-runtime:1.1.0"

    //Progress button extension
    implementation 'com.github.razir.progressbutton:progressbutton:2.1.0'

    //PDF Viewer
    implementation "com.github.barteksc:android-pdf-viewer:$pdf_view_version"

    //Amplitude
    implementation 'com.amplitude:android-sdk:2.25.2'

    //Salesforce chat
    implementation "com.salesforce.service:chat-ui:4.2.2"

    //Jumio
    implementation "com.jumio.android:core:3.9.2@aar"   // Jumio Core library
    implementation "com.jumio.android:nv:3.9.2@aar"     // Netverify library
    implementation "com.jumio.android:nv-barcode:3.9.2@aar"   // Barcode scanning
    implementation "com.jumio.android:nv-mrz:3.9.2@aar" // MRZ scanning

    //AppsFlyer
    implementation 'com.appsflyer:af-android-sdk:6.2.0'
    implementation 'com.android.installreferrer:installreferrer:2.2'

    // Code Scanner & Camera
    implementation "com.google.mlkit:barcode-scanning:$barcode_scanner_version"
    implementation "androidx.camera:camera-camera2:$camerax_version"
    implementation "androidx.camera:camera-lifecycle:$camerax_version"
    implementation "androidx.camera:camera-view:$camera_view_version"

    // Braze (marketing push notifications)
    implementation "com.appboy:android-sdk-ui:$appboy_version"

    // Room
    implementation "androidx.room:room-ktx:$room_version"
    kapt "androidx.room:room-compiler:$room_version"
    androidTestImplementation "androidx.room:room-testing:$room_version"
    implementation "androidx.room:room-runtime:$room_version"

    // Compose
    implementation "androidx.compose.material3:material3:$compose_material3"
    implementation "androidx.compose.runtime:runtime:$compose_version"
    implementation "androidx.compose.ui:ui:$compose_version"
    implementation "androidx.compose.foundation:foundation:$compose_version"
    implementation "androidx.compose.foundation:foundation-layout:$compose_version"
    implementation "androidx.compose.material:material:$compose_version"
    implementation "androidx.compose.runtime:runtime-livedata:$compose_version"
    implementation "androidx.compose.ui:ui-tooling:$compose_version"
    implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
    implementation "androidx.activity:activity-compose:$activity_compose"
    androidTestImplementation "androidx.compose.ui:ui-test:$compose_version"
    androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
    debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"

    // MP Charts
    implementation "com.github.PhilJay:MPAndroidChart:v$mp_chart_version"

    // Testing dependencies
    androidTestImplementation "androidx.arch.core:core-testing:$core_testing_version"
    androidTestImplementation "androidx.test.espresso:espresso-contrib:$espresso_version"
    androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_version"

    // Modules
    lintChecks project(':lint')

    // Miscellaneous
    implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_reflect_version"
    //Memory leak analysis - should only run in dev builds (devqaImplementation)
    //devqaImplementation 'com.squareup.leakcanary:leakcanary-android:2.2'
}

Getting this warning message, I updated already everything what I am missing can somone tell me?

We recommend using a newer Android Gradle plugin to use compileSdk = 33

This Android Gradle plugin (7.2.1) was tested up to compileSdk = 32

This warning can be suppressed by adding
    android.suppressUnsupportedCompileSdk=33
to this project's gradle.properties

The build will continue, but you are strongly encouraged to update your project to
use a newer Android Gradle Plugin that has been tested with compileSdk = 33

thanks

Kotlin Learner
  • 3,995
  • 6
  • 47
  • 127

4 Answers4

15

As this message is just a warning, if your build is working fine, I'd suggest you to suppress the warning and don't update your Android Gradle plugin for now. Upgrading this plugin can bring you more trouble than good.

The Android Gradle plugin is published to the Google's Maven repository at maven.google.com.

The plugin's listing with all its versions can be found here. You can pick a version of that list and test your build.

Just update the following line of your build.gradle file with the desired version:

dependencies {
    classpath 'com.android.tools.build:gradle:<NEW_VERSION_HERE>'
    ...
}

Keep in mind that you might need to update your Android Studio to the Beta or Canary channels do be able to use the newer versions of that plugin without problems.

Daniel Schröder
  • 547
  • 4
  • 18
5

Update plugins in build.gradle (project)

id 'com.android.application' version '7.3.0' apply false
id 'com.android.library' version '7.3.0' apply false

It works for me.

3

Add android.suppressUnsupportedCompileSdk=33 to your gradle.properties file:

Adriaan
  • 17,741
  • 7
  • 42
  • 75
  • 1
    Please delete one of your two practically identical answers. You probably want to delete the downvoted one, the other one. – Yunnosch May 03 '23 at 22:49
  • 1
    Welcome to Stack Overflow! Please take the [tour] and read up on [answer]. This post could use some [edit]ing to explain why adding this would solve the problem. – Adriaan May 04 '23 at 05:34
  • Suppressing a warning is not a solution though. Is it? – ravi Jul 03 '23 at 07:13
1

The follwing changes works for me:

ctrl+alt+shift+S

In ProjectStructure change the

Modules / Properties / Compile SDK version / 33

Modules / Default Config / Target SDK version / 33

Modules / Default Config / Min SDK version / 33

Than choose an emulator with API 33, example: Pixel 6 API 33

Adriaan
  • 17,741
  • 7
  • 42
  • 75
Nuno Jesus
  • 43
  • 3