Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error code -7 when trying to install release APK

Tags:

java

android

I've taken all appropriate steps to create the release APK. (Demonstration of steps required)

My device (Nexus 7 2012) is set to allow installs from unknown sources.

I emailed the APK (app-release.apk) to myself and attempted to open it from GMail, as this should work.

EDIT: I apologize, I also should have included that I did uninstall the app from settings > apps > (app in question) > "uninstall" button.

However, the app immediately fails to load, with only the following logcat info:

05-30 14:44:41.689      466-497/? W/PackageManager﹕ Package edu.osu.expandablelistviewtest1 signatures do not match the previously installed version; ignoring!
05-30 14:44:41.914      466-497/? I/art﹕ Explicit concurrent mark sweep GC freed 74971(3MB) AllocSpace objects, 22(1348KB) LOS objects, 33% free, 28MB/43MB, paused 9.752ms total 220.463ms
05-30 14:44:41.927  20704-20704/? D/InstallAppProgress﹕ Installation error code: -7
05-30 14:44:43.094  20704-20704/? I/InstallAppProgress﹕ Finished installing edu.osu.expandablelistviewtest1

I've tried every search string I can think of and can't find any information on error -7's meaning. Looking at the code on GitHub, we see the following code:

public void handleMessage(Message msg) {
  ...
  if (msg.arg1 == PackageManager.INSTALL_SUCCEEDED) {
    ...
  } else if (msg.arg1 == PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE){
    ...
   } else {
    // Generic error handling for all other error codes.
    centerTextDrawable.setLevel(1);
    centerExplanationLabel = getExplanationFromErrorCode(msg.arg1);
    centerTextLabel = R.string.install_failed;
    mLaunchButton.setVisibility(View.INVISIBLE);
  }
  ...
  private int getExplanationFromErrorCode(int errCode) {
    Log.d(TAG, "Installation error code: " + errCode);
    switch (errCode) {
    case PackageManager.INSTALL_FAILED_INVALID_APK:
      return R.string.install_failed_invalid_apk;
    case PackageManager.INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES:
      return R.string.install_failed_inconsistent_certificates;
    case PackageManager.INSTALL_FAILED_OLDER_SDK:
      return R.string.install_failed_older_sdk;
    case PackageManager.INSTALL_FAILED_CPU_ABI_INCOMPATIBLE:
      return R.string.install_failed_cpu_abi_incompatible;
    default:
      return -1;
    }
  }
  ...
}

...so we have no way of knowing what the "-7" means. (Beyond that it is none of the switch cases.)

I'm open to any ideas / suggestions. Thank you.

like image 265
somecbusnerd Avatar asked May 30 '15 19:05

somecbusnerd


1 Answers

Well, I feel sheepish. After all that, the issue was that in newer versions of Android, uninstalling in the manner I mentioned above only uninstalls for that specific user.

The answer is to go to settings > apps > (app in question) and then to select "uninstall for all users" from the "..." menu in the upper right.

So for future Google searchers:

InstallAppProgress﹕ Installation error code: -7 evidently means you have to completely uninstall a previous version of your app, such as previous debug versions, etc.

like image 63
somecbusnerd Avatar answered Sep 30 '22 17:09

somecbusnerd