androidfluttergradlebuild

Flutter Run Failure [INSTALL_FAILED_OLDER_SDK] Requires newer sdk version #31 (current version is #30)


When I try flutter run the following error occurs:

Error: ADB exited with exit code 1
Performing Streamed Install

adb: failed to install C:\Flutter\appname\build\app\outputs\flutter-apk\app.apk: Failure [INSTALL_FAILED_OLDER_SDK: Failed parse during installPackageLI: /data/app/vmdl1847062534.tmp/base.apk (at Binary XML file line #7):    
Requires newer sdk version #31 (current version is #30)]
Error launching application on SM A127F.

Here is part of my build.gradle file

defaultConfig {
        applicationId "de.domain.appname"
        minSdkVersion 31
        multiDexEnabled true
        targetSdkVersion 31
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

Solution

  • The problem is due to android SDK version mismatch between your app and the target device (i.e. real phone or emulator).

    From your case it seems like your app is built with SDK version 31 and you are trying to run it on a device which supports version 30 resulting in the issue. TO fix this either downgrade the your app's SDK need to 30 or run it on a newer device that supports SDK 31.