安裝APK的錯誤碼(PackageManager.java)

安裝APK的錯誤碼,定義在Android源碼中的這個文件中:
frameworks\base\core\Java\android\content\pm\PackageManager.java

  1. /** 
  2.  * if the package is already installed. 
  3.  * 程序已經存在 
  4.  */  
  5. public static final int INSTALL_FAILED_ALREADY_EXISTS = -1;  
  6.   
  7.   
  8. /** 
  9.  * if the package archive file is invalid. 
  10.  * 無效的APK 
  11.  */  
  12. public static final int INSTALL_FAILED_INVALID_APK = -2;  
  13.   
  14.   
  15. /** 
  16.  * if the URI passed in is invalid. 
  17.  * 無效的鏈接 
  18.  */  
  19. public static final int INSTALL_FAILED_INVALID_URI = -3;  
  20.   
  21.   
  22. /** 
  23.  * if the package manager service found that the device  
  24.  *   didn't have enough storage space to install the app. 
  25.  * 沒有足夠的存儲空間 
  26.  */  
  27. public static final int INSTALL_FAILED_INSUFFICIENT_STORAGE = -4;  
  28.   
  29.   
  30. /** 
  31.  * if a package is already installed with the same name. 
  32.  * 已存在同名程序 
  33.  */  
  34. public static final int INSTALL_FAILED_DUPLICATE_PACKAGE = -5;  
  35.   
  36.   
  37. /** 
  38.  * if the requested shared user does not exist. 
  39.  * 共享用戶不存在 
  40.  */  
  41. public static final int INSTALL_FAILED_NO_SHARED_USER = -6;  
  42.   
  43.   
  44. /** 
  45.  * if a previously installed package of the same name has a different signature 
  46.  *   than the new package (and the old package's data was not removed). 
  47.  * 更新不兼容 
  48.  */  
  49. public static final int INSTALL_FAILED_UPDATE_INCOMPATIBLE = -7;  
  50.   
  51.   
  52. /** 
  53.  * if the new package is requested a shared user which is already installed  
  54.  *   on the device and does not have matching signature. 
  55.  * 共享用戶不兼容 
  56.  */  
  57. public static final int INSTALL_FAILED_SHARED_USER_INCOMPATIBLE = -8;  
  58.   
  59.   
  60. /** 
  61.  * if the new package uses a shared library that is not available. 
  62.  * 共享庫已丟失 
  63.  */  
  64. public static final int INSTALL_FAILED_MISSING_SHARED_LIBRARY = -9;  
  65.   
  66.   
  67. /** 
  68.  * if the new package uses a shared library that is not available. 
  69.  * 替換時無法刪除 
  70.  */  
  71. public static final int INSTALL_FAILED_REPLACE_COULDNT_DELETE = -10;  
  72.   
  73.   
  74. /** 
  75.  * if the new package failed while optimizing and validating its dex files, 
  76.  *   either because there was not enough storage or the validation failed. 
  77.  * 空間不足或驗證失敗 
  78.  */  
  79. public static final int INSTALL_FAILED_DEXOPT = -11;  
  80.   
  81.   
  82. /** 
  83.  * if the new package failed because the current SDK version is older than 
  84.  * that required by the package. 
  85.  * 系統版本過舊 
  86.  */  
  87. public static final int INSTALL_FAILED_OLDER_SDK = -12;  
  88.   
  89.   
  90. /** 
  91.  * if the new package failed because it contains a content provider with the 
  92.  *   same authority as a provider already installed in the system. 
  93.  * 存在同名的內容提供者 
  94.  */  
  95. public static final int INSTALL_FAILED_CONFLICTING_PROVIDER = -13;  
  96.   
  97.   
  98. /** 
  99.  * if the new package failed because the current SDK version is newer than 
  100.  *   that required by the package. 
  101.  * 系統版本過新 
  102.  */  
  103. public static final int INSTALL_FAILED_NEWER_SDK = -14;  
  104.   
  105.   
  106. /** 
  107.  * if the new package failed because it has specified that it is a test-only 
  108.  *   package and the caller has not supplied the {@link #INSTALL_ALLOW_TEST} 
  109.  *   flag. 
  110.  * 調用者不被允許測試的測試程序 
  111.  */  
  112. public static final int INSTALL_FAILED_TEST_ONLY = -15;  
  113.   
  114.   
  115. /** 
  116.  * if the package being installed contains native code, but none that is 
  117.  *   compatible with the the device's CPU_ABI. 
  118.  * 包含的本機代碼不兼容CPU_ABI 
  119.  */  
  120. public static final int INSTALL_FAILED_CPU_ABI_INCOMPATIBLE = -16;  
  121.   
  122.   
  123. /** 
  124.  * if the new package uses a feature that is not available. 
  125.  * 使用了一個無效的特性 
  126.  */  
  127. public static final int INSTALL_FAILED_MISSING_FEATURE = -17;  
  128.   
  129.   
  130. // ------ Errors related to sdcard  
  131. /** 
  132.  * if a secure container mount point couldn't be accessed on external media. 
  133.  * SD卡訪問失敗 
  134.  */  
  135. public static final int INSTALL_FAILED_CONTAINER_ERROR = -18;  
  136.   
  137.   
  138. /** 
  139.  * if the new package couldn't be installed in the specified install location. 
  140.  * 無效的安裝路徑 
  141.  */  
  142. public static final int INSTALL_FAILED_INVALID_INSTALL_LOCATION = -19;  
  143.   
  144.   
  145. /** 
  146.  * if the new package couldn't be installed in the specified install 
  147.  *   location because the media is not available. 
  148.  * SD卡不可用 
  149.  */  
  150. public static final int INSTALL_FAILED_MEDIA_UNAVAILABLE = -20;  
  151.   
  152.   
  153. /** 
  154.  * if the new package couldn't be installed because the verification timed out. 
  155.  * 驗證超時 
  156.  */  
  157. public static final int INSTALL_FAILED_VERIFICATION_TIMEOUT = -21;  
  158.   
  159.   
  160. /** 
  161.  * if the new package couldn't be installed because the verification did not succeed. 
  162.  * 驗證失敗 
  163.  */  
  164. public static final int INSTALL_FAILED_VERIFICATION_FAILURE = -22;  
  165.   
  166.   
  167. /** 
  168.  * if the package changed from what the calling program expected. 
  169.  * 預期的應用被改變 
  170.  */  
  171. public static final int INSTALL_FAILED_PACKAGE_CHANGED = -23;  
  172.   
  173.   
  174. /** 
  175.  * if the parser was given a path that is not a file, or does not end  
  176.  *   with the expected '.apk' extension. 
  177.  * 解析失敗,不是APK 
  178.  */  
  179. public static final int INSTALL_PARSE_FAILED_NOT_APK = -100;  
  180.   
  181.   
  182. /** 
  183.  * if the parser was unable to retrieve the AndroidManifest.xml file. 
  184.  * 解析失敗,無法提取Manifest 
  185.  */  
  186. public static final int INSTALL_PARSE_FAILED_BAD_MANIFEST = -101;  
  187.   
  188.   
  189. /** 
  190.  * if the parser encountered an unexpected exception. 
  191.  * 解析失敗,無法預期的異常 
  192.  */  
  193. public static final int INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION = -102;  
  194.   
  195.   
  196. /** 
  197.  * if the parser did not find any certificates in the .apk. 
  198.  * 解析失敗,找不到證書 
  199.  */  
  200. public static final int INSTALL_PARSE_FAILED_NO_CERTIFICATES = -103;  
  201.   
  202.   
  203. /** 
  204.  * if the parser found inconsistent certificates on the files in the .apk. 
  205.  * 解析失敗,證書不一致 
  206.  */  
  207. public static final int INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES = -104;  
  208.   
  209.   
  210. /** 
  211.  * if the parser encountered a CertificateEncodingException in one of the 
  212.  *   files in the .apk. 
  213.  * 解析失敗,證書編碼異常 
  214.  */  
  215. public static final int INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING = -105;  
  216.   
  217.   
  218. /** 
  219.  * if the parser encountered a bad or missing package name in the manifest. 
  220.  * 解析失敗,manifest中的包名錯誤或丟失 
  221.  */  
  222. public static final int INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME = -106;  
  223.   
  224.   
  225. /** 
  226.  * if the parser encountered a bad shared user id name in the manifest. 
  227.  * 解析失敗,manifest中的共享用戶錯誤 
  228.  */  
  229. public static final int INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID = -107;  
  230.   
  231.   
  232. /** 
  233.  * if the parser encountered some structural problem in the manifest. 
  234.  * 解析失敗,manifest中出現結構性錯誤 
  235.  */  
  236. public static final int INSTALL_PARSE_FAILED_MANIFEST_MALFORMED = -108;  
  237.   
  238.   
  239. /** 
  240.  * if the parser did not find any actionable tags (instrumentation or application) 
  241.  *   in the manifest. 
  242.  * 解析失敗,manifest中沒有actionable tags 
  243.  */  
  244. public static final int INSTALL_PARSE_FAILED_MANIFEST_EMPTY = -109;  
  245.   
  246.   
  247. /** 
  248.  * if the system failed to install the package because of system issues. 
  249.  * 系統問題導致安裝失敗 
  250.  */  
  251. public static final int INSTALL_FAILED_INTERNAL_ERROR = -110
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章