2

I am installing Android app with target sdk version android S in Android phone with Api level 30. My default config settings for app is like

compileSdkVersion 'android-S'
buildToolsVersion "30.0.3"

defaultConfig {
    applicationId "com.example.test"
    minSdkVersion 21
    targetSdkVersion "S"
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

But when I install the apk in Emulator with Api Level 30 I am getting error as

Installation did not succeed.
The application could not be installed: INSTALL_FAILED_OLDER_SDK

The application's minSdkVersion is newer than the device API level.

How to resolve this ? Which things need to be modified to make it working ?

Satyam Gondhale
  • 1,415
  • 1
  • 16
  • 43

2 Answers2

2

targetSdkVersion "S"

Using a prelimary version the minSdkVersion becomes S too automatically.

blackapps
  • 8,011
  • 2
  • 11
  • 25
  • Didn't get it. Can you please provide some more details ? – Satyam Gondhale Jun 22 '21 at 09:34
  • There is nothing more in it. What is unclear? – blackapps Jun 22 '21 at 11:56
  • Apparently this how preview builds have worked for a while. I did not realize. See the answer on this old question: "If you compile against a preview SDK, the build tools will lock minSdkVersion and targetSdkVersion to that same API level. This results in the produced application being unable to be installed on devices running older releases of Android..." https://stackoverflow.com/questions/24457831/failure-install-failed-older-sdk-android-l Indeed, the answer to set targetSdkVersion to 31 does seem to work even though Android Studio does not yet display the S Preview as SDK 31. – Robert Nekic Jun 23 '21 at 14:17
0

Changing to this version worked

compileSdkVersion 'android-S'
buildToolsVersion "30.0.3"

defaultConfig {
    applicationId "com.example.test"
    minSdkVersion 21
    targetSdkVersion 31
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Satyam Gondhale
  • 1,415
  • 1
  • 16
  • 43