安装APK的错误码(PackageManager.java)

安装APK的错误码,定义在android源码中的这个文件中:
frameworks\base\core\java\android\content\pm\PackageManager.java

/**
 * if the package is already installed.
 * 程序已经存在
 */
public static final int INSTALL_FAILED_ALREADY_EXISTS = -1;

/**
 * if the package archive file is invalid.
 * 无效的APK
 */
public static final int INSTALL_FAILED_INVALID_APK = -2;

/**
 * if the URI passed in is invalid.
 * 无效的链接
 */
public static final int INSTALL_FAILED_INVALID_URI = -3;

/**
 * if the package manager service found that the device
 *   didn‘t have enough storage space to install the app.
 * 没有足够的存储空间
 */
public static final int INSTALL_FAILED_INSUFFICIENT_STORAGE = -4;

/**
 * if a package is already installed with the same name.
 * 已存在同名程序
 */
public static final int INSTALL_FAILED_DUPLICATE_PACKAGE = -5;

/**
 * if the requested shared user does not exist.
 * 共享用户不存在
 */
public static final int INSTALL_FAILED_NO_SHARED_USER = -6;

/**
 * if a previously installed package of the same name has a different signature
 *   than the new package (and the old package‘s data was not removed).
 * 更新不兼容
 */
public static final int INSTALL_FAILED_UPDATE_INCOMPATIBLE = -7;

/**
 * if the new package is requested a shared user which is already installed
 *   on the device and does not have matching signature.
 * 共享用户不兼容
 */
public static final int INSTALL_FAILED_SHARED_USER_INCOMPATIBLE = -8;

/**
 * if the new package uses a shared library that is not available.
 * 共享库已丢失
 */
public static final int INSTALL_FAILED_MISSING_SHARED_LIBRARY = -9;

/**
 * if the new package uses a shared library that is not available.
 * 替换时无法删除
 */
public static final int INSTALL_FAILED_REPLACE_COULDNT_DELETE = -10;

/**
 * if the new package failed while optimizing and validating its dex files,
 *   either because there was not enough storage or the validation failed.
 * 空间不足或验证失败
 */
public static final int INSTALL_FAILED_DEXOPT = -11;

/**
 * if the new package failed because the current SDK version is older than
 * that required by the package.
 * 系统版本过旧
 */
public static final int INSTALL_FAILED_OLDER_SDK = -12;

/**
 * if the new package failed because it contains a content provider with the
 *   same authority as a provider already installed in the system.
 * 存在同名的内容提供者
 */
public static final int INSTALL_FAILED_CONFLICTING_PROVIDER = -13;

/**
 * if the new package failed because the current SDK version is newer than
 *   that required by the package.
 * 系统版本过新
 */
public static final int INSTALL_FAILED_NEWER_SDK = -14;

/**
 * if the new package failed because it has specified that it is a test-only
 *   package and the caller has not supplied the {@link #INSTALL_ALLOW_TEST}
 *   flag.
 * 调用者不被允许测试的测试程序
 */
public static final int INSTALL_FAILED_TEST_ONLY = -15;

/**
 * if the package being installed contains native code, but none that is
 *   compatible with the the device‘s CPU_ABI.
 * 包含的本机代码不兼容CPU_ABI
 */
public static final int INSTALL_FAILED_CPU_ABI_INCOMPATIBLE = -16;

/**
 * if the new package uses a feature that is not available.
 * 使用了一个无效的特性
 */
public static final int INSTALL_FAILED_MISSING_FEATURE = -17;

// ------ Errors related to sdcard
/**
 * if a secure container mount point couldn‘t be accessed on external media.
 * SD卡访问失败
 */
public static final int INSTALL_FAILED_CONTAINER_ERROR = -18;

/**
 * if the new package couldn‘t be installed in the specified install location.
 * 无效的安装路径
 */
public static final int INSTALL_FAILED_INVALID_INSTALL_LOCATION = -19;

/**
 * if the new package couldn‘t be installed in the specified install
 *   location because the media is not available.
 * SD卡不可用
 */
public static final int INSTALL_FAILED_MEDIA_UNAVAILABLE = -20;

/**
 * if the new package couldn‘t be installed because the verification timed out.
 * 验证超时
 */
public static final int INSTALL_FAILED_VERIFICATION_TIMEOUT = -21;

/**
 * if the new package couldn‘t be installed because the verification did not succeed.
 * 验证失败
 */
public static final int INSTALL_FAILED_VERIFICATION_FAILURE = -22;

/**
 * if the package changed from what the calling program expected.
 * 预期的应用被改变
 */
public static final int INSTALL_FAILED_PACKAGE_CHANGED = -23;

/**
 * if the parser was given a path that is not a file, or does not end
 *   with the expected ‘.apk‘ extension.
 * 解析失败,不是APK
 */
public static final int INSTALL_PARSE_FAILED_NOT_APK = -100;

/**
 * if the parser was unable to retrieve the AndroidManifest.xml file.
 * 解析失败,无法提取Manifest
 */
public static final int INSTALL_PARSE_FAILED_BAD_MANIFEST = -101;

/**
 * if the parser encountered an unexpected exception.
 * 解析失败,无法预期的异常
 */
public static final int INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION = -102;

/**
 * if the parser did not find any certificates in the .apk.
 * 解析失败,找不到证书
 */
public static final int INSTALL_PARSE_FAILED_NO_CERTIFICATES = -103;

/**
 * if the parser found inconsistent certificates on the files in the .apk.
 * 解析失败,证书不一致
 */
public static final int INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES = -104;

/**
 * if the parser encountered a CertificateEncodingException in one of the
 *   files in the .apk.
 * 解析失败,证书编码异常
 */
public static final int INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING = -105;

/**
 * if the parser encountered a bad or missing package name in the manifest.
 * 解析失败,manifest中的包名错误或丢失
 */
public static final int INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME = -106;

/**
 * if the parser encountered a bad shared user id name in the manifest.
 * 解析失败,manifest中的共享用户错误
 */
public static final int INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID = -107;

/**
 * if the parser encountered some structural problem in the manifest.
 * 解析失败,manifest中出现结构性错误
 */
public static final int INSTALL_PARSE_FAILED_MANIFEST_MALFORMED = -108;

/**
 * if the parser did not find any actionable tags (instrumentation or application)
 *   in the manifest.
 * 解析失败,manifest中没有actionable tags
 */
public static final int INSTALL_PARSE_FAILED_MANIFEST_EMPTY = -109;

/**
 * if the system failed to install the package because of system issues.
 * 系统问题导致安装失败
 */
public static final int INSTALL_FAILED_INTERNAL_ERROR = -110;

/** * if the package is already installed. * 程序已经存在 */public static final int INSTALL_FAILED_ALREADY_EXISTS = -1;

/** * if the package archive file is invalid. * 无效的APK */public static final int INSTALL_FAILED_INVALID_APK = -2;

/** * if the URI passed in is invalid. * 无效的链接 */public static final int INSTALL_FAILED_INVALID_URI = -3;

/** * if the package manager service found that the device  *   didn‘t have enough storage space to install the app. * 没有足够的存储空间 */public static final int INSTALL_FAILED_INSUFFICIENT_STORAGE = -4;

/** * if a package is already installed with the same name. * 已存在同名程序 */public static final int INSTALL_FAILED_DUPLICATE_PACKAGE = -5;

/** * if the requested shared user does not exist. * 共享用户不存在 */public static final int INSTALL_FAILED_NO_SHARED_USER = -6;

/** * if a previously installed package of the same name has a different signature *   than the new package (and the old package‘s data was not removed). * 更新不兼容 */public static final int INSTALL_FAILED_UPDATE_INCOMPATIBLE = -7;

/** * if the new package is requested a shared user which is already installed  *   on the device and does not have matching signature. * 共享用户不兼容 */public static final int INSTALL_FAILED_SHARED_USER_INCOMPATIBLE = -8;

/** * if the new package uses a shared library that is not available. * 共享库已丢失 */public static final int INSTALL_FAILED_MISSING_SHARED_LIBRARY = -9;

/** * if the new package uses a shared library that is not available. * 替换时无法删除 */public static final int INSTALL_FAILED_REPLACE_COULDNT_DELETE = -10;

/** * if the new package failed while optimizing and validating its dex files, *   either because there was not enough storage or the validation failed. * 空间不足或验证失败 */public static final int INSTALL_FAILED_DEXOPT = -11;

/** * if the new package failed because the current SDK version is older than * that required by the package. * 系统版本过旧 */public static final int INSTALL_FAILED_OLDER_SDK = -12;

/** * if the new package failed because it contains a content provider with the *   same authority as a provider already installed in the system. * 存在同名的内容提供者 */public static final int INSTALL_FAILED_CONFLICTING_PROVIDER = -13;

/** * if the new package failed because the current SDK version is newer than *   that required by the package. * 系统版本过新 */public static final int INSTALL_FAILED_NEWER_SDK = -14;

/** * if the new package failed because it has specified that it is a test-only *   package and the caller has not supplied the {@link #INSTALL_ALLOW_TEST} *   flag. * 调用者不被允许测试的测试程序 */public static final int INSTALL_FAILED_TEST_ONLY = -15;

/** * if the package being installed contains native code, but none that is *   compatible with the the device‘s CPU_ABI. * 包含的本机代码不兼容CPU_ABI */public static final int INSTALL_FAILED_CPU_ABI_INCOMPATIBLE = -16;

/** * if the new package uses a feature that is not available. * 使用了一个无效的特性 */public static final int INSTALL_FAILED_MISSING_FEATURE = -17;

// ------ Errors related to sdcard/** * if a secure container mount point couldn‘t be accessed on external media. * SD卡访问失败 */public static final int INSTALL_FAILED_CONTAINER_ERROR = -18;

/** * if the new package couldn‘t be installed in the specified install location. * 无效的安装路径 */public static final int INSTALL_FAILED_INVALID_INSTALL_LOCATION = -19;

/** * if the new package couldn‘t be installed in the specified install *   location because the media is not available. * SD卡不可用 */public static final int INSTALL_FAILED_MEDIA_UNAVAILABLE = -20;

/** * if the new package couldn‘t be installed because the verification timed out. * 验证超时 */public static final int INSTALL_FAILED_VERIFICATION_TIMEOUT = -21;

/** * if the new package couldn‘t be installed because the verification did not succeed. * 验证失败 */public static final int INSTALL_FAILED_VERIFICATION_FAILURE = -22;

/** * if the package changed from what the calling program expected. * 预期的应用被改变 */public static final int INSTALL_FAILED_PACKAGE_CHANGED = -23;

/** * if the parser was given a path that is not a file, or does not end  *   with the expected ‘.apk‘ extension. * 解析失败,不是APK */public static final int INSTALL_PARSE_FAILED_NOT_APK = -100;

/** * if the parser was unable to retrieve the AndroidManifest.xml file. * 解析失败,无法提取Manifest */public static final int INSTALL_PARSE_FAILED_BAD_MANIFEST = -101;

/** * if the parser encountered an unexpected exception. * 解析失败,无法预期的异常 */public static final int INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION = -102;

/** * if the parser did not find any certificates in the .apk. * 解析失败,找不到证书 */public static final int INSTALL_PARSE_FAILED_NO_CERTIFICATES = -103;

/** * if the parser found inconsistent certificates on the files in the .apk. * 解析失败,证书不一致 */public static final int INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES = -104;

/** * if the parser encountered a CertificateEncodingException in one of the *   files in the .apk. * 解析失败,证书编码异常 */public static final int INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING = -105;

/** * if the parser encountered a bad or missing package name in the manifest. * 解析失败,manifest中的包名错误或丢失 */public static final int INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME = -106;

/** * if the parser encountered a bad shared user id name in the manifest. * 解析失败,manifest中的共享用户错误 */public static final int INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID = -107;

/** * if the parser encountered some structural problem in the manifest. * 解析失败,manifest中出现结构性错误 */public static final int INSTALL_PARSE_FAILED_MANIFEST_MALFORMED = -108;

/** * if the parser did not find any actionable tags (instrumentation or application) *   in the manifest. * 解析失败,manifest中没有actionable tags */public static final int INSTALL_PARSE_FAILED_MANIFEST_EMPTY = -109;

/** * if the system failed to install the package because of system issues. * 系统问题导致安装失败 */public static final int INSTALL_FAILED_INTERNAL_ERROR = -110;

时间: 2024-08-03 16:31:13

安装APK的错误码(PackageManager.java)的相关文章

我的Android进阶之旅------>解决Android Studio编译后安装apk报错:The APK file does not exist on disk

1.错误描述 今天用Android Studio编译应用后安装APK的时候,报错了,错误如下所示: The APK file build\outputs\apk\OYP_2.3.4_I2Base_6476_official_debug.apk does not exist on disk. Error while Installing APK 如下图所示 2.解决方法 1.尝试了Build -> Clean Project再编译,还是无效 2.尝试重启Android Studio无效 然后我去打

Android N安装apk报错:android.os.FileUriExposedException

StackOverflow: http://stackoverflow.com/questions/38200282/android-os-fileuriexposedexception-file-storage-emulated-0-test-txt-exposed 1.在AndroidMainifest.xml文件中添加: <provider android:name="android.support.v4.content.FileProvider" android:auth

安装apk报错INSTALL_FAILED_UPDATE_INCOMPATIBLE的解决方法

其实不能叫解决方法,因为最后没解决(囧),只是觉得解决的过程有一定的意义,故记录一下 问题的产生是因为要在一部中兴手机上安装中兴应用市场,不过手机上之前已经有了中兴应用市场(我自己要装的是debug版的,没签名).于是乎第一次安装就报上面的错了 一看到错我就纳闷了,不是把老版本的apk卸了吗,怎么还是报冲突.于是网上找了半天,在/data/data/目录下把该apk的目录删了,再run,依然无效. 又在网上看到另一种做法,把/system/packages.xml中该apk的节点信息删除.看了下

Android安装apk时报错:INSTALL_FAILED_NO_MATCHING_ABIS

问题背景 OS:无关 AS:无关 Genymotion:2.5.2 Virtual Device:Google Nexus 5 - 5.1.0 - API 22 原因分析 CPU架构不符 解决方案 对于Genymotion,搜索并安装ARM Translation Installer v1.1,安装方式为直接将zip包拖拽至模拟器界面(未生效) 换用实机进行调试 -_-! 参考资料 http://stackoverflow.com/questions/24572052/install-faile

解决 genymotion 安装apk报错 app contains ARM native code and your Genymotion device cannot run ARM instructions

1.某些APP安装在模拟器时提示“ this probably means that the app contains ARM native code and your Genymotion device cannot run ARM instructions. You should either build your native code to x86 or install an ARM tanslation tool in your device.” 解决方案:1.下载并安装Genymot

Java异常封装(自定义错误码和描写叙述,附源代码)

真正工作了才发现.Java里面的异常在真正工作中使用还是十分普遍的. 什么时候该抛出什么异常,这个是必须知道的. 当然真正工作里面主动抛出的异常都是经过分装过的,自己能够定义错误码和异常描写叙述. 以下小宝鸽就为大家介绍一个Java异常简单封装的样例. 在给出异常分装样例之前.须要给大家普及Java里面的checked异常和unchecked异常的个概念. 一.checked异常和unchecked异常 这里之所以让大家清楚checked异常和unchecked异常概念,是由于:待会我们的异常是

ORACLE.错误码&#160;ORA-12154 及Oracle客户端免安装版的设置

.错误码 ORA-12154相信作为ORACLE数据库的开发人员没有少碰到“ORA-12154: TNS: 无法解析指定的连接标识符”,今天我也又碰到了类似的情况,将我的解决方法进行小结,希望能对碰到同样问题的友人们提供帮助.问题场景描述:服务器端版本:oracle 10.2.0.10客户端版本:oracle 10.2.0.10客户端开发工具:PL/SQL Developer通过客户端来连接服务器,其主要文件就是通过客户端的tnsnames.ora来配置,在原文件的基础上增加:SID别名 =  

arcgis 10.2 的常用中文版安装教程(启动错误码-15解决版本)

常用文字说明是这样的 1.先配置环境,安装D:\ARCGIS 安装包\Pre-release_license_manager文件夹下setup程序进行安装 2.运行Arcgis License server administrator,点stop,安装完之后立刻停掉服务(很重要) 第一步装完,在所有程序,arcgis文件夹下License Manager 启动Arcgis License server administrator 这个界面 先停止掉这个服务 3.打开service.txt程序,把

java异常和错误码定义规范及其使用

前言 本随笔是最近进行实际项目开发时总结的一些经验,可供需要的伙伴借鉴. 场景 使用java提供服务的后端系统,使用者(可能是web前端或者是第三方调用者)通过api形式进行调用. 以前可能遇到的问题 这里会不会发生异常?如果发生了我应该怎么做? 我要定义哪些自定义异常? 捕获到一个"未知"异常时,我该将其抛出去还是就地打印其堆栈信息? 问题分析 为什么会产生异常? 简单理解就是,异常是程序执行过程中未按预想状态执行的状态. 为什么要自定义异常? 1)与系统(这里指的是非本项目)异常做