2020-04-21 ADB安装错误提示

1.adb push XXX.apk 目录是将apk发送到手机指定的目录

adb push test.apk /sdcard/test/test.apk

2.adb install 电脑中apk的路径是安装电脑中的apk到手机

adb install /Users/test/test.apk

3.强制安装
有时候会出现Read-only的错误,我们可以使用强制安装命令来安装apk

adb install -r /Users/test/test.apk

adb的安装过程分为传输与安装两步。

~~在出错后,adb会报告错误信息,但是信息可能只是一个代号,需要自己定位分析出错的原因。 ~~

几种常见的错误及解决方法:

1、INSTALL_FAILED_INVALID_APK
无效的安装包,安装包已损坏请检查安装包是否完整。如果是xpk包,可以通过手动安装xpk来检测一下。如果是apk包,请重 新下载。

2、INSTALL_FAILED_OLDER_SDK
系统版本过低当前程序不支持您的手机。

3、INSTALL_FAILED_INSUFFICIENT_STORAGE
没有足够的存储空间

4、INSTALL_FAILED_INVALID_INSTALL_LOCATION
无效的安装位置

5、INSTALL_CANCELED_BY_USER
系统禁止安装未知来源的应用
这个要在Android系统设置里修改,勾选安全选项里的未知来源,允许安装。

6、INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES
安装包签名不一致
这样的问题主要是签名冲突造成的,比如你使用了ADB的debug权限签名,但后来使用标准sign签名后再安装同一个文件会出现这样的错误提示,解决的方法除了只有先老老实实从手机上卸载原有版本再进行安装,而adb install -r参数也无法解决这个问题。

7、INSTALL_FAILED_INVALID_URI
应用为中文名, adb install 中文.apk时出现此问题。修改为英文名就OK了。


错误基本是在 cmd 命令行安装时遇到的。

提示 含义
CPU_ABIINSTALL_FAILED_MISSING_FEATURE 使用了一个无效的特性
DEFAULT 未知错误
INSTALL_FAILED_ALREADY_EXISTS 程序已经存在
INSTALL_FAILED_CONFLICTING_PROVIDER 存在同名的内容提供者
INSTALL_FAILED_CONTAINER_ERROR SD卡访问失败
INSTALL_FAILED_CPU_ABI_INCOMPATIBLE 包含的本机代码不兼容
INSTALL_FAILED_DEXOPT dex优化验证失败
INSTALL_FAILED_DUPLICATE_PACKAGE 已存在同名程序
INSTALL_FAILED_INSUFFICIENT_STORAGE 没有足够的存储空间
INSTALL_FAILED_INTERNAL_ERROR 系统问题导致安装失败
INSTALL_FAILED_INVALID_APK 无效的APK
INSTALL_FAILED_INVALID_URI 无效的链接
INSTALL_FAILED_INVALID_INSTALL_LOCATION 无效的安装路径
INSTALL_FAILED_MEDIA_UNAVAILABLE SD卡不存在
INSTALL_FAILED_MISSING_SHARED_LIBRARY 需求的共享库已丢失
INSTALL_FAILED_NEWER_SDK 系统版本过新
INSTALL_FAILED_NO_SHARED_USER 要求的共享用户不存在
INSTALL_FAILED_OLDER_SDK 系统版本过旧
INSTALL_FAILED_REPLACE_COULDNT_DELETE 需求的共享库无效
INSTALL_FAILED_SHARED_USER_INCOMPATIBLE 需求的共享用户签名错误
INSTALL_FAILED_TEST_ONLY 调用者不被允许测试的测试程序
INSTALL_FAILED_UPDATE_INCOMPATIBLE 版本不能共存
INSTALL_FAILED_VERSION_DOWNGRADE 当前程序的版本低于已安装的程序

安装APK的错误码android源码

安装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;
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 159,716评论 4 364
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 67,558评论 1 294
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 109,431评论 0 244
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 44,127评论 0 209
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 52,511评论 3 287
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,692评论 1 222
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,915评论 2 313
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,664评论 0 202
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,412评论 1 246
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,616评论 2 245
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 32,105评论 1 260
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,424评论 2 254
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 33,098评论 3 238
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,096评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,869评论 0 197
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,748评论 2 276
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,641评论 2 271

推荐阅读更多精彩内容