android adb install 失败的错误分析 PartII

android 源码中, 关于install apk failed 的错误定义


     /**
0320      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
0321      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} on success.
0322      * @hide
0323      */
0324     public static final int INSTALL_SUCCEEDED = 1;
0325 
0326     /**
0327      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
0328      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package is
0329      * already installed.
0330      * @hide
0331      */
0332     public static final int INSTALL_FAILED_ALREADY_EXISTS = -1;
0333 
0334     /**
0335      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
0336      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package archive
0337      * file is invalid.
0338      * @hide
0339      */
0340     public static final int INSTALL_FAILED_INVALID_APK = -2;
0341 
0342     /**
0343      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
0344      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the URI passed in
0345      * is invalid.
0346      * @hide
0347      */
0348     public static final int INSTALL_FAILED_INVALID_URI = -3;
0349 
0350     /**
0351      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
0352      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if the package manager
0353      * service found that the device didn't have enough storage space to install the app.
0354      * @hide
0355      */
0356     public static final int INSTALL_FAILED_INSUFFICIENT_STORAGE = -4;
0357 
0358     /**
0359      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
0360      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if a
0361      * package is already installed with the same name.
0362      * @hide
0363      */
0364     public static final int INSTALL_FAILED_DUPLICATE_PACKAGE = -5;
0365 
0366     /**
0367      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
0368      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
0369      * the requested shared user does not exist.
0370      * @hide
0371      */
0372     public static final int INSTALL_FAILED_NO_SHARED_USER = -6;
0373 
0374     /**
0375      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
0376      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
0377      * a previously installed package of the same name has a different signature
0378      * than the new package (and the old package's data was not removed).
0379      * @hide
0380      */
0381     public static final int INSTALL_FAILED_UPDATE_INCOMPATIBLE = -7;
0382 
0383     /**
0384      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
0385      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
0386      * the new package is requested a shared user which is already installed on the
0387      * device and does not have matching signature.
0388      * @hide
0389      */
0390     public static final int INSTALL_FAILED_SHARED_USER_INCOMPATIBLE = -8;
0391 
0392     /**
0393      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
0394      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
0395      * the new package uses a shared library that is not available.
0396      * @hide
0397      */
0398     public static final int INSTALL_FAILED_MISSING_SHARED_LIBRARY = -9;
0399 
0400     /**
0401      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
0402      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
0403      * the new package uses a shared library that is not available.
0404      * @hide
0405      */
0406     public static final int INSTALL_FAILED_REPLACE_COULDNT_DELETE = -10;
0407 
0408     /**
0409      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
0410      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
0411      * the new package failed while optimizing and validating its dex files,
0412      * either because there was not enough storage or the validation failed.
0413      * @hide
0414      */
0415     public static final int INSTALL_FAILED_DEXOPT = -11;
0416 
0417     /**
0418      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
0419      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
0420      * the new package failed because the current SDK version is older than
0421      * that required by the package.
0422      * @hide
0423      */
0424     public static final int INSTALL_FAILED_OLDER_SDK = -12;
0425 
0426     /**
0427      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
0428      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
0429      * the new package failed because it contains a content provider with the
0430      * same authority as a provider already installed in the system.
0431      * @hide
0432      */
0433     public static final int INSTALL_FAILED_CONFLICTING_PROVIDER = -13;
0434 
0435     /**
0436      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
0437      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
0438      * the new package failed because the current SDK version is newer than
0439      * that required by the package.
0440      * @hide
0441      */
0442     public static final int INSTALL_FAILED_NEWER_SDK = -14;
0443 
0444     /**
0445      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
0446      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
0447      * the new package failed because it has specified that it is a test-only
0448      * package and the caller has not supplied the {@link #INSTALL_ALLOW_TEST}
0449      * flag.
0450      * @hide
0451      */
0452     public static final int INSTALL_FAILED_TEST_ONLY = -15;
0453 
0454     /**
0455      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
0456      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
0457      * the package being installed contains native code, but none that is
0458      * compatible with the the device's CPU_ABI.
0459      * @hide
0460      */
0461     public static final int INSTALL_FAILED_CPU_ABI_INCOMPATIBLE = -16;
0462 
0463     /**
0464      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
0465      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
0466      * the new package uses a feature that is not available.
0467      * @hide
0468      */
0469     public static final int INSTALL_FAILED_MISSING_FEATURE = -17;
0470 
0471     // ------ Errors related to sdcard
0472     /**
0473      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
0474      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
0475      * a secure container mount point couldn't be accessed on external media.
0476      * @hide
0477      */
0478     public static final int INSTALL_FAILED_CONTAINER_ERROR = -18;
0479 
0480     /**
0481      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
0482      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
0483      * the new package couldn't be installed in the specified install
0484      * location.
0485      * @hide
0486      */
0487     public static final int INSTALL_FAILED_INVALID_INSTALL_LOCATION = -19;
0488 
0489     /**
0490      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
0491      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
0492      * the new package couldn't be installed in the specified install
0493      * location because the media is not available.
0494      * @hide
0495      */
0496     public static final int INSTALL_FAILED_MEDIA_UNAVAILABLE = -20;
0497 
0498     /**
0499      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
0500      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
0501      * the new package couldn't be installed because the verification timed out.
0502      * @hide
0503      */
0504     public static final int INSTALL_FAILED_VERIFICATION_TIMEOUT = -21;
0505 
0506     /**
0507      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
0508      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
0509      * the new package couldn't be installed because the verification did not succeed.
0510      * @hide
0511      */
0512     public static final int INSTALL_FAILED_VERIFICATION_FAILURE = -22;
0513 
0514     /**
0515      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
0516      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
0517      * the package changed from what the calling program expected.
0518      * @hide
0519      */
0520     public static final int INSTALL_FAILED_PACKAGE_CHANGED = -23;
0521 
0522     /**
0523      * Installation return code: this is passed to the {@link IPackageInstallObserver} by
0524      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
0525      * the new package is assigned a different UID than it previously held.
0526      * @hide
0527      */
0528     public static final int INSTALL_FAILED_UID_CHANGED = -24;
     /**
0614      * Installation failed return code: this is passed to the {@link IPackageInstallObserver} by
0615      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)}
0616      * if the system failed to install the package because of system issues.
0617      * @hide
0618      */
0619     public static final int INSTALL_FAILED_INTERNAL_ERROR = -110;

you can find the source code here

http://osxr.org/android/source/frameworks/base/core/java/android/content/pm/PackageManager.java

对于这些错误, 后续会根据遇到的情况及对应的处理措施,持续更新。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值