adb安裝應(yīng)用失敗莫换,錯(cuò)誤碼

1.adb push XXX.apk 目錄是將apk發(fā)送到手機(jī)指定的目錄

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

2.adb install 電腦中apk的路徑是安裝電腦中的apk到手機(jī)

????adb install /Users/test/test.apk

3.強(qiáng)制安裝

????有時(shí)候會(huì)出現(xiàn)Read-only的錯(cuò)誤塘辅,我們可以使用強(qiáng)制安裝命令來(lái)安裝apk

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


adb的安裝過(guò)程分為傳輸與安裝兩步陪竿。

在出錯(cuò)后灭忠,adb會(huì)報(bào)告錯(cuò)誤信息跷乐,但是信息可能只是一個(gè)代號(hào)肥败,需要自己定位分析出錯(cuò)的原因。??

幾種常見(jiàn)的錯(cuò)誤及解決方法:?

1愕提、INSTALL_FAILED_INVALID_APK:無(wú)效的安裝包,安裝包已損壞

????????????請(qǐng)檢查安裝包是否完整馒稍。如果是xpk包,可以通過(guò)手動(dòng)安裝xpk來(lái)檢測(cè)一下浅侨。如果是apk包纽谒,請(qǐng)重 ? 新下載。

2如输、INSTALL_FAILED_OLDER_SDK:系統(tǒng)版本過(guò)低

????????????當(dāng)前程序不支持您的手機(jī)鼓黔。

3央勒、INSTALL_FAILED_INSUFFICIENT_STORAGE:沒(méi)有足夠的存儲(chǔ)空間

4、INSTALL_FAILED_INVALID_INSTALL_LOCATION:無(wú)效的安裝位置

5澳化、INSTALL_CANCELED_BY_USER:系統(tǒng)禁止安裝未知來(lái)源的應(yīng)用

????????????這個(gè)要在Android系統(tǒng)設(shè)置里修改崔步,勾選安全選項(xiàng)里的未知來(lái)源,允許安裝缎谷。

6井濒、INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES:安裝包簽名不一致

????????????這樣的問(wèn)題主要是簽名沖突造成的,比如你使用了ADB的debug權(quán)限簽名慎陵,但后來(lái)使用標(biāo)準(zhǔn)sign簽名后再安裝同一個(gè)文件會(huì)出現(xiàn)這樣的錯(cuò)誤提示眼虱,解決的方法除了只有先老老實(shí)實(shí)從手機(jī)上卸載原有版本再進(jìn)行安裝,而adb install -r參數(shù)也無(wú)法解決這個(gè)問(wèn)題席纽。

7捏悬、INSTALL_FAILED_INVALID_URI

????????????應(yīng)用為中文名, adb install 中文.apk時(shí)出現(xiàn)此問(wèn)題。修改為英文名就OK了润梯。


錯(cuò)誤基本是在 cmd 命令行安裝時(shí)遇到的过牙。

INSTALL_FAILED_ALREADY_EXISTS ? ? ? ? ? ? ? ? 程序已經(jīng)存在

INSTALL_FAILED_INVALID_APK ? ? ? ? ? ? ? ? ? ? 無(wú)效的APK

INSTALL_FAILED_INVALID_URI ? ? ? ? ? ? ? ? ? ? 無(wú)效的鏈接

INSTALL_FAILED_INSUFFICIENT_STORAGE ? ? ? ? ?沒(méi)有足夠的存儲(chǔ)空間

INSTALL_FAILED_DUPLICATE_PACKAGE ? ? ? ? ? ? 已存在同名程序

INSTALL_FAILED_NO_SHARED_USER ? ? ? ? ? ? ? ?要求的共享用戶不存在

INSTALL_FAILED_UPDATE_INCOMPATIBLE ? ? ? ? ? 版本不能共存

INSTALL_FAILED_SHARED_USER_INCOMPATIBLE ? ? 需求的共享用戶簽名錯(cuò)誤

INSTALL_FAILED_MISSING_SHARED_LIBRARY ? ? ? 需求的共享庫(kù)已丟失

INSTALL_FAILED_REPLACE_COULDNT_DELETE ? ? ?需求的共享庫(kù)無(wú)效

INSTALL_FAILED_DEXOPT ? ? ? ? ? ? ? ? ? ? ? ? ?dex優(yōu)化驗(yàn)證失敗

INSTALL_FAILED_OLDER_SDK ? ? ? ? ? ? ? ? ? ? ?系統(tǒng)版本過(guò)舊

INSTALL_FAILED_CONFLICTING_PROVIDER ? ? ? ? ?存在同名的內(nèi)容提供者

INSTALL_FAILED_NEWER_SDK ? ? ? ? ? ? ? ? ? ? ?系統(tǒng)版本過(guò)新

INSTALL_FAILED_TEST_ONLY ? ? ? ? ? ? ? ? ? ? ?調(diào)用者不被允許測(cè)試的測(cè)試程序

INSTALL_FAILED_CPU_ABI_INCOMPATIBLE ? ? ? ? 包含的本機(jī)代碼不兼容

CPU_ABIINSTALL_FAILED_MISSING_FEATURE ? ? ? 使用了一個(gè)無(wú)效的特性

INSTALL_FAILED_CONTAINER_ERROR ? ? ? ? ? ? ?SD卡訪問(wèn)失敗

INSTALL_FAILED_INVALID_INSTALL_LOCATION ? ? 無(wú)效的安裝路徑

INSTALL_FAILED_MEDIA_UNAVAILABLE ? ? ? ? ? ?SD卡不存在

INSTALL_FAILED_INTERNAL_ERROR ? ? ? ? ? ? ? ?系統(tǒng)問(wèn)題導(dǎo)致安裝失敗

DEFAULT ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?未知錯(cuò)誤

INSTALL_FAILED_VERSION_DOWNGRADE ?當(dāng)前程序的版本低于已安裝的程序CPU_ABIINSTALL_FAILED_MISSING_FEATURE ??使用了一個(gè)無(wú)效的特性



安裝APK的錯(cuò)誤碼android源碼

安裝APK的錯(cuò)誤碼,定義在android源碼中的這個(gè)文件中:

frameworks\base\core\java\android\content\pm\PackageManager.java

/**

* if the package is already installed.

* 程序已經(jīng)存在

*/

public static final int INSTALL_FAILED_ALREADY_EXISTS = -1;

/**

* if the package archive file is invalid.

* 無(wú)效的APK

*/

public static final int INSTALL_FAILED_INVALID_APK = -2;

/**

* if the URI passed in is invalid.

* 無(wú)效的鏈接

*/

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.

* 沒(méi)有足夠的存儲(chǔ)空間

*/

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.

* 共享庫(kù)已丟失

*/

public static final int INSTALL_FAILED_MISSING_SHARED_LIBRARY = -9;

/**

* if the new package uses a shared library that is not available.

* 替換時(shí)無(wú)法刪除

*/

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.

* 空間不足或驗(yàn)證失敗

*/

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.

* 系統(tǒng)版本過(guò)舊

*/

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.

* 存在同名的內(nèi)容提供者

*/

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.

* 系統(tǒng)版本過(guò)新

*/

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.

* 調(diào)用者不被允許測(cè)試的測(cè)試程序

*/

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.

* 包含的本機(jī)代碼不兼容CPU_ABI

*/

public static final int INSTALL_FAILED_CPU_ABI_INCOMPATIBLE = -16;

/**

* if the new package uses a feature that is not available.

* 使用了一個(gè)無(wú)效的特性

*/

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卡訪問(wèn)失敗

*/

public static final int INSTALL_FAILED_CONTAINER_ERROR = -18;

/**

* if the new package couldn't be installed in the specified install location.

* 無(wú)效的安裝路徑

*/

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.

* 驗(yàn)證超時(shí)

*/

public static final int INSTALL_FAILED_VERIFICATION_TIMEOUT = -21;

/**

* if the new package couldn't be installed because the verification did not succeed.

* 驗(yàn)證失敗

*/

public static final int INSTALL_FAILED_VERIFICATION_FAILURE = -22;

/**

* if the package changed from what the calling program expected.

* 預(yù)期的應(yīng)用被改變

*/

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.

* 解析失敗寇钉,無(wú)法提取Manifest

*/

public static final int INSTALL_PARSE_FAILED_BAD_MANIFEST = -101;

/**

* if the parser encountered an unexpected exception.

* 解析失敗,無(wú)法預(yù)期的異常

*/

public static final int INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION = -102;

/**

* if the parser did not find any certificates in the .apk.

* 解析失敗舶赔,找不到證書(shū)

*/

public static final int INSTALL_PARSE_FAILED_NO_CERTIFICATES = -103;

/**

* if the parser found inconsistent certificates on the files in the .apk.

* 解析失敗扫倡,證書(shū)不一致

*/

public static final int INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES = -104;

/**

* if the parser encountered a CertificateEncodingException in one of the

* files in the .apk.

* 解析失敗,證書(shū)編碼異常

*/

public static final int INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING = -105;

/**

* if the parser encountered a bad or missing package name in the manifest.

* 解析失敗竟纳,manifest中的包名錯(cuò)誤或丟失

*/

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中的共享用戶錯(cuò)誤

*/

public static final int INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID = -107;

/**

* if the parser encountered some structural problem in the manifest.

* 解析失敗,manifest中出現(xiàn)結(jié)構(gòu)性錯(cuò)誤

*/

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中沒(méi)有actionable tags

*/

public static final int INSTALL_PARSE_FAILED_MANIFEST_EMPTY = -109;

/**

* if the system failed to install the package because of system issues.

* 系統(tǒng)問(wèn)題導(dǎo)致安裝失敗

*/

public static final int INSTALL_FAILED_INTERNAL_ERROR = -110;

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末缘挑,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子桶略,更是在濱河造成了極大的恐慌语淘,老刑警劉巖,帶你破解...
    沈念sama閱讀 207,248評(píng)論 6 481
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件际歼,死亡現(xiàn)場(chǎng)離奇詭異惶翻,居然都是意外死亡,警方通過(guò)查閱死者的電腦和手機(jī)蹬挺,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 88,681評(píng)論 2 381
  • 文/潘曉璐 我一進(jìn)店門(mén)维贺,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái),“玉大人巴帮,你說(shuō)我怎么就攤上這事溯泣∨扒铮” “怎么了?”我有些...
    開(kāi)封第一講書(shū)人閱讀 153,443評(píng)論 0 344
  • 文/不壞的土叔 我叫張陵垃沦,是天一觀的道長(zhǎng)客给。 經(jīng)常有香客問(wèn)我,道長(zhǎng)肢簿,這世上最難降的妖魔是什么靶剑? 我笑而不...
    開(kāi)封第一講書(shū)人閱讀 55,475評(píng)論 1 279
  • 正文 為了忘掉前任,我火速辦了婚禮池充,結(jié)果婚禮上桩引,老公的妹妹穿的比我還像新娘。我一直安慰自己收夸,他們只是感情好坑匠,可當(dāng)我...
    茶點(diǎn)故事閱讀 64,458評(píng)論 5 374
  • 文/花漫 我一把揭開(kāi)白布。 她就那樣靜靜地躺著卧惜,像睡著了一般厘灼。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上咽瓷,一...
    開(kāi)封第一講書(shū)人閱讀 49,185評(píng)論 1 284
  • 那天设凹,我揣著相機(jī)與錄音,去河邊找鬼茅姜。 笑死闪朱,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的钻洒。 我是一名探鬼主播监透,決...
    沈念sama閱讀 38,451評(píng)論 3 401
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼航唆!你這毒婦竟也來(lái)了?” 一聲冷哼從身側(cè)響起院刁,我...
    開(kāi)封第一講書(shū)人閱讀 37,112評(píng)論 0 261
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤糯钙,失蹤者是張志新(化名)和其女友劉穎,沒(méi)想到半個(gè)月后退腥,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體任岸,經(jīng)...
    沈念sama閱讀 43,609評(píng)論 1 300
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 36,083評(píng)論 2 325
  • 正文 我和宋清朗相戀三年狡刘,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了享潜。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 38,163評(píng)論 1 334
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡嗅蔬,死狀恐怖剑按,靈堂內(nèi)的尸體忽然破棺而出疾就,到底是詐尸還是另有隱情,我是刑警寧澤艺蝴,帶...
    沈念sama閱讀 33,803評(píng)論 4 323
  • 正文 年R本政府宣布猬腰,位于F島的核電站,受9級(jí)特大地震影響猜敢,放射性物質(zhì)發(fā)生泄漏姑荷。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 39,357評(píng)論 3 307
  • 文/蒙蒙 一缩擂、第九天 我趴在偏房一處隱蔽的房頂上張望鼠冕。 院中可真熱鬧,春花似錦胯盯、人聲如沸懈费。這莊子的主人今日做“春日...
    開(kāi)封第一講書(shū)人閱讀 30,357評(píng)論 0 19
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)楞捂。三九已至,卻和暖如春趋厉,著一層夾襖步出監(jiān)牢的瞬間寨闹,已是汗流浹背。 一陣腳步聲響...
    開(kāi)封第一講書(shū)人閱讀 31,590評(píng)論 1 261
  • 我被黑心中介騙來(lái)泰國(guó)打工君账, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留繁堡,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 45,636評(píng)論 2 355
  • 正文 我出身青樓乡数,卻偏偏與公主長(zhǎng)得像椭蹄,于是被迫代替她去往敵國(guó)和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子净赴,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 42,925評(píng)論 2 344

推薦閱讀更多精彩內(nèi)容