Search code examples
androidandroid-studioandroid-9.0-pie

APK Installation failed after updating target SDK to android P


I have updated compile SDK and target SDK version to android P but after updating application is not able to install it is giving the same error popup even after uninstalling the older version of APK from my device.

My build.gradle settings :

compileSdkVersion 'android-P'
    defaultConfig {
        applicationId "com.my.app"
        minSdkVersion 15
        targetSdkVersion 'P'
        versionCode 31
        versionName "1.2.14"
        multiDexEnabled true
        vectorDrawables.useSupportLibrary = true
    }

Error Popup


Solution

  • What I figured out is that you can't target a developer preview version as the targetSdkVersion in a device or emulator that has a release version. If you really need to set the targetSdkVersion, you need to run it in a device/emulator running android-P developer preview.