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

3

6

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
    }
Diley answered 9/10, 2022 at 10:47 Comment(4)
DId you try deleting the build folder doing a clean build?Bunns
Yes, unfortunately still the same errorDiley
Seems like the phone you are trying to run on that could be with sdk 30. Try changing your config to sdk 30Bunns
Yes, that's it! I used a physical device (Samsung A12) which needs Sdk 30. Switching minSdkVersion to 30 worked. Thanks a lot!Diley
B
12

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.

Bunns answered 10/10, 2022 at 7:48 Comment(2)
I already figured it out. This was exactly the problem. Target Device was on SDK 30 while App was on SDK 31. Thanks!Diley
How exactly did you fix it? Which setting/line in which file (manifest?)?Verlinevermeer
F
0

I encountered the same issue myself. Simply ensure that you update your Android Studio to the latest version, then proceed to update the SDK. Afterward, utilize the most recent version of the Android Emulator along with the latest Android operating system version available. This should effectively resolve the problem you're experiencing.

Fragment answered 16/4 at 8:29 Comment(0)
C
-1

We recieved an email that the apps should have minimum support of API 34 in playstore by 31st Aug 2024. So we updated it to minSdkVersion 34.

enter image description here

ERROR: Then after running the app we got this error.

enter image description here

ISSUE : We were trying to run the updated app in a emulator which supported upto API 33.

SOLUTION : Create a new simulator which supports above API 34, I installed one which supported upto API 35. The app started working after this.

enter image description here

Cyton answered 10/7 at 6:43 Comment(1)
Google requires targetSdk to be 34, not minimumSdk.Graphite

© 2022 - 2024 — McMap. All rights reserved.