INSTALL_FAILED_OLDER_SDK ERROR

Install APK with adb:
$ platform-tools/adb install out/target/product/generic/system/app/Bundled.apk
233 KB/s (12588 bytes in 0.052s)
pkg: /data/local/tmp/Bundled.apk
Failure [INSTALL_FAILED_OLDER_SDK]
Error message in logcat:
D/PackageParser(   60): Scanning package: /data/app/vmdl64930.tmp
W/PackageParser(   60): /data/app/vmdl64930.tmp (at Binary XML file line #0): Requires development platform AOSP but this is a release platform.
The error was created by android.content.pm.PackageParser, which compares the android:minSdkVersion and android:targetSdkVersion attributes of the uses-sdk element of AndroidManifest.xml in the APK file against the SDK version of the device or emulator. The SDK version on the device has to be greater than that required by android:minSdkVersion.

In my case, since I built the package with AOSP, the target emulator has to be AOSP also. This is the relavant section in AndroidManifest.xml:
<uses-sdk android:minSdkVersion="AOSP"
        android:targetSdkVersion="AOSP">
</uses-sdk>



And the relevant section in android.content.pm.PackageParser:
if (minCode != null) {
    if (!minCode.equals(SDK_CODENAME)) {
if (SDK_CODENAME != null) {
    outError[0] = "Requires development platform " + minCode
    + " (current platform is " + SDK_CODENAME + ")";
} else {
    outError[0] = "Requires development platform " + minCode
    + " but this is a release platform.";
}
mParseError = PackageManager.INSTALL_FAILED_OLDER_SDK;
return null;
    }
} else if (minVers > SDK_VERSION) {
    outError[0] = "Requires newer sdk version #" + minVers
    + " (current version is #" + SDK_VERSION + ")";
    mParseError = PackageManager.INSTALL_FAILED_OLDER_SDK;
    return null;
}
                   
if (targetCode != null) {
    if (!targetCode.equals(SDK_CODENAME)) {
if (SDK_CODENAME != null) {
    outError[0] = "Requires development platform " + targetCode
    + " (current platform is " + SDK_CODENAME + ")";
} else {
    outError[0] = "Requires development platform " + targetCode
    + " but this is a release platform.";
}
mParseError = PackageManager.INSTALL_FAILED_OLDER_SDK;
return null;
    }
    // If the code matches, it definitely targets this SDK.
    pkg.applicationInfo.targetSdkVersion
    = android.os.Build.VERSION_CODES.CUR_DEVELOPMENT;
} else {
    pkg.applicationInfo.targetSdkVersion = targetVers;
}

你可能感兴趣的:(Install)