安装提示错误 [INSTALL_FAILED_OLDER_SDK]的解决方案
2013-08-06 16:11
441 查看
原先在1.6rc1上写的程序,拿到1.5的SDK重新编译后却不能用
abd install bin/xxx.apk
安装上去,提示错误是:
Failure [INSTALL_FAILED_OLDER_SDK]
找了一下,是这个原因:
打开源码目录下的AndroidManifest.xml文件,然后注释掉或者删除掉这行:
<uses-sdk android:minSdkVersion="4" />
另一篇文章:
通过在manifest中添加android.uid.system和在Android.mk中添加LOCAL_CERTIFICATE := platform,然后MMM编译以获取次特权。但是我通过MMM编译出来的APK不能在系统提供的SDK中创建的***D里安装,提示Failure [INSTALL_FAILED_OLDER_SDK]
解决方法:
/build/core/version_defaults.mk文件中这一段
ifeq "" "$(DEFAULT_APP_TARGET_SDK)"
# This is the default minSdkVersion and targetSdkVersion to use for
# all .apks created by the build system. It can be overridden by explicitly
# setting these in the .apk's AndroidManifest.xml. It is either the code
# name of the development build or, if this is a release build, the official
# SDK version of this release.
ifeq "REL" "$(PLATFORM_VERSION_CODENAME)"
DEFAULT_APP_TARGET_SDK := $(PLATFORM_SDK_VERSION)
else
DEFAULT_APP_TARGET_SDK := $(PLATFORM_VERSION_CODENAME)
endif
endif
将DEFAULT_APP_TARGET_SDK直接赋值相应的API等级即可。
另一篇文章:
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;
}
结论:只有apk无源代码,无解。
abd install bin/xxx.apk
安装上去,提示错误是:
Failure [INSTALL_FAILED_OLDER_SDK]
找了一下,是这个原因:
打开源码目录下的AndroidManifest.xml文件,然后注释掉或者删除掉这行:
<uses-sdk android:minSdkVersion="4" />
另一篇文章:
通过在manifest中添加android.uid.system和在Android.mk中添加LOCAL_CERTIFICATE := platform,然后MMM编译以获取次特权。但是我通过MMM编译出来的APK不能在系统提供的SDK中创建的***D里安装,提示Failure [INSTALL_FAILED_OLDER_SDK]
解决方法:
/build/core/version_defaults.mk文件中这一段
ifeq "" "$(DEFAULT_APP_TARGET_SDK)"
# This is the default minSdkVersion and targetSdkVersion to use for
# all .apks created by the build system. It can be overridden by explicitly
# setting these in the .apk's AndroidManifest.xml. It is either the code
# name of the development build or, if this is a release build, the official
# SDK version of this release.
ifeq "REL" "$(PLATFORM_VERSION_CODENAME)"
DEFAULT_APP_TARGET_SDK := $(PLATFORM_SDK_VERSION)
else
DEFAULT_APP_TARGET_SDK := $(PLATFORM_VERSION_CODENAME)
endif
endif
将DEFAULT_APP_TARGET_SDK直接赋值相应的API等级即可。
另一篇文章:
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;
}
结论:只有apk无源代码,无解。
相关文章推荐
- Android模拟器下安装APP报INSTALL_FAILED_NO_MATCHING_ABIS错误解决方案
- Android安装软件时出现的错误提示:INSTALL_FAILED_CONTAINER_ERROR的解决方法
- Android安装软件出现错误提示:INSTALL_FAILED_CONTAINER_ERROR
- Installation error: INSTALL_FAILED_INSUFFICIENT_STORAGE无法安装错误解决方案
- Installation error: INSTALL_FAILED_INSUFFICIENT_STORAGE无法安装错误解决方案
- 安装APK失败,错误代码:INSTALL_FAILED_INVALID_APK 解决方案
- 安装apk的时候总是提示 INSTALL_PARSE_FAILED_NO_CERTIFICATES 错误
- Installation error: INSTALL_FAILED_INSUFFICIENT_STORAGE无法安装错误解决方案
- Android apk安装失败 Failure [INSTALL_FAILED_OLDER_SDK]
- Installation error: INSTALL_FAILED_INSUFFICIENT_STORAGE无法安装错误解决方案
- Failure [INSTALL_FAILED_OLDER_SDK]错误修改方案
- Android开发之Failure [INSTALL_FAILED_OLDER_SDK]错误
- 安装APK失败,错误代码:INSTALL_FAILED_INVALID_APK 解决方案
- Android安装软件提示:“INSTALL_FAILED_DEXOPT”的解决方案
- GPhone安装软件提示:“INSTALL_FAILED_DEXOPT”的解决方案
- Android模拟器安装APP出现INSTALL_FAILED_NO_MATCHING_ABIS错误解决方案
- 安装APK在android7.0以下版本出现INSTALL_PARSE_FAILED_NO_CERTIFICATES错误的解决方案
- Installation error: INSTALL_FAILED_INSUFFICIENT_STORAGE无法安装错误解决方案
- [INSTALL_FAILED_OLDER_SDK]错误
- android应用安装提示INSTALL_FAILED_SHARED_USER_INCOMPATIBLE错误的解决方法