首页 > 其他分享 >android开发apk安装失败对应的错误码以及原因

android开发apk安装失败对应的错误码以及原因

时间:2022-10-11 15:02:43浏览次数:59  
标签:code hide int 错误码 apk static INSTALL android public

android开发apk安装失败对应的错误码以及原因
代码在PackageManager.java系统类里
中文意思可参考:https://www.cnblogs.com/cwfsoft/p/11776094.html
/**
 * @hide	未知
 */
public static final int INSTALL_UNKNOWN = 0;

/**
 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
 * on success.
 *
 * @hide	成功
 */
@SystemApi
public static final int INSTALL_SUCCEEDED = 1;

/**
 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
 * if the package is already installed.
 *
 * @hide	已经存在
 */
@SystemApi
public static final int INSTALL_FAILED_ALREADY_EXISTS = -1;

/**
 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
 * if the package archive file is invalid.
 *
 * @hide	无效apk
 */
@SystemApi
public static final int INSTALL_FAILED_INVALID_APK = -2;

/**
 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
 * if the URI passed in is invalid.
 *
 * @hide	无效uri
 */
@SystemApi
public static final int INSTALL_FAILED_INVALID_URI = -3;

/**
 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
 * if the package manager service found that the device didn't have enough storage space to
 * install the app.
 *
 * @hide	空间不足
 */
@SystemApi
public static final int INSTALL_FAILED_INSUFFICIENT_STORAGE = -4;

/**
 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
 * if a package is already installed with the same name.
 *
 * @hide	同包名已存在
 */
@SystemApi
public static final int INSTALL_FAILED_DUPLICATE_PACKAGE = -5;

/**
 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
 * if the requested shared user does not exist.
 *
 * @hide	共享用户不存在
 */
@SystemApi
public static final int INSTALL_FAILED_NO_SHARED_USER = -6;

/**
 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
 * 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).
 *
 * @hide	更新不兼容
 */
@SystemApi
public static final int INSTALL_FAILED_UPDATE_INCOMPATIBLE = -7;

/**
 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
 * if the new package is requested a shared user which is already installed on the device and
 * does not have matching signature.
 *
 * @hide	签名不兼容
 */
@SystemApi
public static final int INSTALL_FAILED_SHARED_USER_INCOMPATIBLE = -8;

/**
 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
 * if the new package uses a shared library that is not available.
 *
 * @hide	共享库缺失
 */
@SystemApi
public static final int INSTALL_FAILED_MISSING_SHARED_LIBRARY = -9;

/**
 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
 * when the package being replaced is a system app and the caller didn't provide the
 * {@link #DELETE_SYSTEM_APP} flag.
 *
 * @hide	替换系统app但缺少DELETE_SYSTEM_APP
 */
@SystemApi
public static final int INSTALL_FAILED_REPLACE_COULDNT_DELETE = -10;

/**
 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
 * if the new package failed while optimizing and validating its dex files, either because there
 * was not enough storage or the validation failed.
 *
 * @hide	dexopt失败可能是空间不足或者校验失败
 */
@SystemApi
public static final int INSTALL_FAILED_DEXOPT = -11;

/**
 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
 * if the new package failed because the current SDK version is older than that required by the
 * package.
 *
 * @hide	更低sdk版本
 */
@SystemApi
public static final int INSTALL_FAILED_OLDER_SDK = -12;

/**
 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
 * if the new package failed because it contains a content provider with the same authority as a
 * provider already installed in the system.
 *
 * @hide
 */
@SystemApi
public static final int INSTALL_FAILED_CONFLICTING_PROVIDER = -13;

/**
 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
 * if the new package failed because the current SDK version is newer than that required by the
 * package.
 *
 * @hide
 */
@SystemApi
public static final int INSTALL_FAILED_NEWER_SDK = -14;

/**
 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
 * 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.
 *
 * @hide	test-only,直接拖出来安装一般会出现,解决方法:对apk签名或者adb install -t
 */
@SystemApi
public static final int INSTALL_FAILED_TEST_ONLY = -15;

/**
 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
 * if the package being installed contains native code, but none that is compatible with the
 * device's CPU_ABI.
 *
 * @hide
 */
@SystemApi
public static final int INSTALL_FAILED_CPU_ABI_INCOMPATIBLE = -16;

/**
 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
 * if the new package uses a feature that is not available.
 *
 * @hide
 */
@SystemApi
public static final int INSTALL_FAILED_MISSING_FEATURE = -17;

// ------ Errors related to sdcard
/**
 * Installation return code: this is passed in the
 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if a secure container mount point couldn't be
 * accessed on external media.
 *
 * @hide
 */
@SystemApi
public static final int INSTALL_FAILED_CONTAINER_ERROR = -18;

/**
 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
 * if the new package couldn't be installed in the specified install location.
 *
 * @hide
 */
@SystemApi
public static final int INSTALL_FAILED_INVALID_INSTALL_LOCATION = -19;

/**
 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
 * if the new package couldn't be installed in the specified install location because the media
 * is not available.
 *
 * @hide
 */
@SystemApi
public static final int INSTALL_FAILED_MEDIA_UNAVAILABLE = -20;

/**
 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
 * if the new package couldn't be installed because the verification timed out.
 *
 * @hide
 */
@SystemApi
public static final int INSTALL_FAILED_VERIFICATION_TIMEOUT = -21;

/**
 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
 * if the new package couldn't be installed because the verification did not succeed.
 *
 * @hide
 */
@SystemApi
public static final int INSTALL_FAILED_VERIFICATION_FAILURE = -22;

/**
 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
 * if the package changed from what the calling program expected.
 *
 * @hide
 */
@SystemApi
public static final int INSTALL_FAILED_PACKAGE_CHANGED = -23;

/**
 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
 * if the new package is assigned a different UID than it previously held.
 *
 * @hide
 */
public static final int INSTALL_FAILED_UID_CHANGED = -24;

/**
 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
 * if the new package has an older version code than the currently installed package.
 *
 * @hide
 */
public static final int INSTALL_FAILED_VERSION_DOWNGRADE = -25;

/**
 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
 * if the old package has target SDK high enough to support runtime permission and the new
 * package has target SDK low enough to not support runtime permissions.
 *
 * @hide
 */
@SystemApi
public static final int INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE = -26;

/**
 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
 * if the new package attempts to downgrade the target sandbox version of the app.
 *
 * @hide
 */
@SystemApi
public static final int INSTALL_FAILED_SANDBOX_VERSION_DOWNGRADE = -27;

/**
 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
 * if the new package requires at least one split and it was not provided.
 *
 * @hide
 */
public static final int INSTALL_FAILED_MISSING_SPLIT = -28;

/**
 * Installation parse return code: this is passed in the
 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser was given a path that is not a
 * file, or does not end with the expected '.apk' extension.
 *
 * @hide
 */
@SystemApi
public static final int INSTALL_PARSE_FAILED_NOT_APK = -100;

/**
 * Installation parse return code: this is passed in the
 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser was unable to retrieve the
 * AndroidManifest.xml file.
 *
 * @hide
 */
@SystemApi
public static final int INSTALL_PARSE_FAILED_BAD_MANIFEST = -101;

/**
 * Installation parse return code: this is passed in the
 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered an unexpected
 * exception.
 *
 * @hide
 */
@SystemApi
public static final int INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION = -102;

/**
 * Installation parse return code: this is passed in the
 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser did not find any certificates in
 * the .apk.
 *
 * @hide
 */
@SystemApi
public static final int INSTALL_PARSE_FAILED_NO_CERTIFICATES = -103;

/**
 * Installation parse return code: this is passed in the
 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser found inconsistent certificates on
 * the files in the .apk.
 *
 * @hide
 */
@SystemApi
public static final int INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES = -104;

/**
 * Installation parse return code: this is passed in the
 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered a
 * CertificateEncodingException in one of the files in the .apk.
 *
 * @hide
 */
@SystemApi
public static final int INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING = -105;

/**
 * Installation parse return code: this is passed in the
 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered a bad or missing
 * package name in the manifest.
 *
 * @hide
 */
@SystemApi
public static final int INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME = -106;

/**
 * Installation parse return code: tthis is passed in the
 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered a bad shared user id
 * name in the manifest.
 *
 * @hide
 */
@SystemApi
public static final int INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID = -107;

/**
 * Installation parse return code: this is passed in the
 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser encountered some structural
 * problem in the manifest.
 *
 * @hide
 */
@SystemApi
public static final int INSTALL_PARSE_FAILED_MANIFEST_MALFORMED = -108;

/**
 * Installation parse return code: this is passed in the
 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the parser did not find any actionable tags
 * (instrumentation or application) in the manifest.
 *
 * @hide
 */
@SystemApi
public static final int INSTALL_PARSE_FAILED_MANIFEST_EMPTY = -109;

/**
 * Installation failed return code: this is passed in the
 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package
 * because of system issues.
 *
 * @hide
 */
@SystemApi
public static final int INSTALL_FAILED_INTERNAL_ERROR = -110;

/**
 * Installation failed return code: this is passed in the
 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package
 * because the user is restricted from installing apps.
 *
 * @hide
 */
public static final int INSTALL_FAILED_USER_RESTRICTED = -111;

/**
 * Installation failed return code: this is passed in the
 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package
 * because it is attempting to define a permission that is already defined by some existing
 * package.
 * <p>
 * The package name of the app which has already defined the permission is passed to a
 * {@link PackageInstallObserver}, if any, as the {@link #EXTRA_FAILURE_EXISTING_PACKAGE} string
 * extra; and the name of the permission being redefined is passed in the
 * {@link #EXTRA_FAILURE_EXISTING_PERMISSION} string extra.
 *
 * @hide
 */
public static final int INSTALL_FAILED_DUPLICATE_PERMISSION = -112;

/**
 * Installation failed return code: this is passed in the
 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package
 * because its packaged native code did not match any of the ABIs supported by the system.
 *
 * @hide
 */
public static final int INSTALL_FAILED_NO_MATCHING_ABIS = -113;

/**
 * Internal return code for NativeLibraryHelper methods to indicate that the package
 * being processed did not contain any native code. This is placed here only so that
 * it can belong to the same value space as the other install failure codes.
 *
 * @hide
 */
@UnsupportedAppUsage
public static final int NO_NATIVE_LIBRARIES = -114;

/** {@hide} */
public static final int INSTALL_FAILED_ABORTED = -115;

/**
 * Installation failed return code: install type is incompatible with some other
 * installation flags supplied for the operation; or other circumstances such as trying
 * to upgrade a system app via an Incremental or instant app install.
 * @hide
 */
public static final int INSTALL_FAILED_SESSION_INVALID = -116;

/**
 * Installation parse return code: this is passed in the
 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the dex metadata file is invalid or
 * if there was no matching apk file for a dex metadata file.
 *
 * @hide
 */
public static final int INSTALL_FAILED_BAD_DEX_METADATA = -117;

/**
 * Installation parse return code: this is passed in the
 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if there is any signature problem.
 *
 * @hide
 */
public static final int INSTALL_FAILED_BAD_SIGNATURE = -118;

/**
 * Installation failed return code: a new staged session was attempted to be committed while
 * there is already one in-progress or new session has package that is already staged.
 *
 * @hide
 */
public static final int INSTALL_FAILED_OTHER_STAGED_SESSION_IN_PROGRESS = -119;

/**
 * Installation failed return code: one of the child sessions does not match the parent session
 * in respect to staged or rollback enabled parameters.
 *
 * @hide
 */
public static final int INSTALL_FAILED_MULTIPACKAGE_INCONSISTENCY = -120;

/**
 * Installation failed return code: the required installed version code
 * does not match the currently installed package version code.
 *
 * @hide
 */
public static final int INSTALL_FAILED_WRONG_INSTALLED_VERSION = -121;

/**
 * Installation return code: this is passed in the {@link PackageInstaller#EXTRA_LEGACY_STATUS}
 * if the new package failed because it contains a request to use a process that was not
 * explicitly defined as part of its &lt;processes&gt; tag.
 *
 * @hide
 */
public static final int INSTALL_FAILED_PROCESS_NOT_DEFINED = -122;

/**
 * Installation parse return code: system is in a minimal boot state, and the parser only
 * allows the package with {@code coreApp} manifest attribute to be a valid application.
 *
 * @hide
 */
public static final int INSTALL_PARSE_FAILED_ONLY_COREAPP_ALLOWED = -123;

/**
 * Installation failed return code: the {@code resources.arsc} of one of the APKs being
 * installed is compressed or not aligned on a 4-byte boundary. Resource tables that cannot be
 * memory mapped exert excess memory pressure on the system and drastically slow down
 * construction of {@link Resources} objects.
 *
 * @hide
 */
public static final int INSTALL_PARSE_FAILED_RESOURCES_ARSC_COMPRESSED = -124;

/**
 * Installation failed return code: the package was skipped and should be ignored.
 *
 * The reason for the skip is undefined.
 * @hide
 */
public static final int INSTALL_PARSE_FAILED_SKIPPED = -125;

/**
 * Installation failed return code: this is passed in the
 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package
 * because it is attempting to define a permission group that is already defined by some
 * existing package.
 *
 * @hide
 */
public static final int INSTALL_FAILED_DUPLICATE_PERMISSION_GROUP = -126;

/**
 * Installation failed return code: this is passed in the
 * {@link PackageInstaller#EXTRA_LEGACY_STATUS} if the system failed to install the package
 * because it is attempting to define a permission in a group that does not exists or that is
 * defined by an packages with an incompatible certificate.
 *
 * @hide
 */
public static final int INSTALL_FAILED_BAD_PERMISSION_GROUP = -127;

标签:code,hide,int,错误码,apk,static,INSTALL,android,public
From: https://www.cnblogs.com/yongfengnice/p/16779190.html

相关文章

  • 直播系统搭建,Android设置背景图延伸到状态栏
    直播系统搭建,Android设置背景图延伸到状态栏 if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP){      //5.0全透明实现      //......
  • Android studio安装教程
    Androidstudio安装教程傻瓜式教程如果想要彻底重装Androidstudio可以删除目录C:\Users\用户名中的以下几个文件夹。.android.gradle.Androidstudio(Androidstud......
  • Android开发 Jetpack_Compose_2 页面预览@Preview
    前言在学习jetpackcompose如何编写ui之前,我认为还是应该先了解与Androidstudio配合的页面预览@Preview。这样就可以立刻看到UI效果,从而方便后续学习验证代码。所......
  • [Android开发学iOS系列] iOS写UI的几种方式
    [Android开发学iOS系列]iOS写UI的几种方式作为一个现代化的平台,iOS的发展也经历了好几个时代.本文讲讲iOS写UI的几种主要方式和各自的特点.iOS写UI的方式在iOS中写U......
  • Android投屏工具
    苹果家族的投屏方式十分舒服,但Android投屏到WindowsPC上需借助第三方软件(大都收费,甚至不少是流氓软件)。GitHub上有一个开源项目——scrcpy,使用体验很好。1.投......
  • Android-Log工具类
    一、Log的基本格式如下为AndroidStudio抓取的一条Log:格式:datetimePID-TID/packagepriority/tag:message例子:2022-09-2119:34:15.29314923-14923/com.lzq.mycu......
  • Flutter(六):Flutter_Boost接入现有原生工程(iOS+Android)
    一、新建原生工程和FlutterModule1、新建Android工程搭建一个空的Android工程FlutterDemo_Android模拟已经存在的原有工程Android项目配置:2、新建iOS工程搭建一个空......
  • android反调试技术
    检测调试相关文件android_server等intSearchFile(){DIR*dir=opendir("/data/local/tmp");if(NULL==dir){return-1;}dirent*file=......
  • MobPush Android For Unity
    集成准备注册账号使用MobSDK之前,需要先在MobTech官网注册开发者账号,并获取MobTech提供的AppKey和AppSecret,详情可以​​点击查看注册流程​​下载MobPush对应的.unitypackag......
  • android hook之ELF hook
    android平台的ELFhook技术LD_PRELOADhooklinker程序在对elf可执行程序进行重定位时会根据so库加载的顺序去寻找对应导出符号。利用LD_PRELOAD优先加载自定义的so库并......