Unable to install app to device specified with targetSdkVersion:Tiramisu - Android

914 views Asked by At

I am currently doing some testing on Android 13 Tiramisu and am having trouble getting the app to install on my device. I have installed Android Tiramisu Preview (Rev.4) in Android Studio. I created a sample app and configured it as follows

// build.gradle
android {
    compileSdkPreview "android-Tiramisu"

    defaultConfig {
        applicationId "com.example.myapplication"
        minSdk 16
        targetSdkPreview "Tiramisu"
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    ...

I then tried to install this app on my Android 12 (not Tiramisu) device. When I did so, I got the following error

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

List of apks:
[0] '/Users/myuser/dev/sample/MyApplication/app/build/outputs/apk/debug/app-debug.apk'
The application's minSdkVersion is newer than the device API level.

In build.gradle, I have specified minSdk 16, so it should be possible to install the app on an Android 12 device. How can I solve this problem? (This problem did not occur when targetSdkVersion was set to anything other than Tiramisu)

1

There are 1 answers

3
Alejandra On

This is working as intended: targeting / compile with a pre-release version of Android will only work on pre-release device, before SDK is final. The error returned could be clearer, as it is misleading right now.