skip to Main Content

I have a well working android app, developed in kotlin . i updated the target sdk to 31 in app level build.gradle file,

plugins {
    id 'com.android.application'
    id 'com.google.gms.google-services'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'

android {
    buildFeatures {
        viewBinding true
    }

    compileSdkVersion 31
    buildToolsVersion '28.0.3'
    defaultConfig {
        applicationId "com.win.app"
        minSdkVersion 21
        targetSdkVersion 31
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    defaultConfig {
        vectorDrawables.useSupportLibrary = true
        aaptOptions.cruncherEnabled = false
        aaptOptions.useNewCruncher = false
        compileOptions.encoding = 'ISO-8859-1'
        multiDexEnabled true

    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    // For Kotlin users also import the Kotlin extensions library for Play In-App Review:
    implementation 'androidx.work:work-runtime:2.7.1'
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.google.android.play:review:2.0.1'
    implementation 'com.google.firebase:firebase-messaging-ktx:23.0.2'
    implementation 'com.github.bumptech.glide:glide:4.9.0'
    // For Kotlin users, also add the Kotlin extensions library for Play In-App Review:

    testImplementation 'junit:junit:4.12'
    androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation platform('com.google.firebase:firebase-bom:31.1.1')
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'com.google.firebase:firebase-analytics-ktx'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    //implementation 'com.google.android.gms:play-services-ads:18.1.0'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation "com.airbnb.android:lottie:3.4.0"
}
repositories {
    mavenCentral()
}


it works on all versions of android execpt Android 12 and android 13 (but it runs on android 13 emulator). Please help me figure out and solve this issue
I’m using a depreciated method Network info ( as of sdk 31 it’s depreciated . Will that be the reason causing the crash on opening? but it still runs on a android 11 device and android 13 emulator.

i tried,

implementation 'androidx.work:work-runtime:2.7.1'

but it didn’t work .

2

Answers


  1. Chosen as BEST ANSWER

    Just resolved it by updating the deprecated methods.


  2. Update this for Android 12 & 13

    compileSdkVersion 33
    targetSdkVersion 33
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search