android - studio - app not installed the package appears to be corrupt nougat

Android App Users Get “App not installed” When Attempting to Update (4)

I got this error while installing on my Android device a new APK for the app I am developing.

I checked the debug log on the device (using "adb -d logcat > log.txt") and found an entry saying "PackageManager: Downgrade detected: Update version code 2 is older than current 10000". Obviously something went wrong with the versioning somehow.

I uninstalled the package and then was able to install the APK with no problems.

UPDATE: To those who asked about which error codes the users are receiving: there are no error codes. It just opens a blank, post-installation page that says "The app was not installed" with a big 'X' next to it. It's possible different versions of Android could have different messages. There is no indication for what went wrong during the installation.

UPDATE 2: Some users reported that they receive error code "-504" when they try to install/update from the Play Store, and the "app not installed" message when manually trying to install the .apk. I don't know what correlation this error has with users being unable to install, but the solutions from the only 2 questions on SO on this topic did not fix anything for me. I've included the updated manifests and build files.

UPDATE 3: It appears as users report this issue in versions after IAB has been successfully installed, which further de-legitimatizes the concept that this issue is caused by introducing IAB.

UPDATE 4: It looks like the problem is with old users trying to update to a new version, and not with new users. With that in mind, there is a high likelihood that this issue is result of INSTALL_FAILED_UID_CHANGED. Looking through the version history, the significant change I made in the problematic version that users cannot update from is removing drawables that I no longer intended of using.

Asking users to go through the procedure to fix this isn't plausible. If there is a solution that I can enforce which would fix it for faulty users, wonderful... if not, the least I can do at this point is damage control and ensure this doesn't happen in the future.

NOTE: Below is the original post speculating that the problem is the result of introducing IAB into the app. Since then, it has become more and more unlikely for that to be the cause. Regardless, the post still has relevant information.


Original Title: Android App Users Get "App not installed" After Introducing IAB

I recently introduced IAB in my app that was published on Google Play. After a while, I've started to get reports from some users that they get an "installation unsuccessful" error when they try to install or update it. What makes me think it's caused by introducing IAB is that one particular long-time user e-mailed me that when he's attempting to update to the version with IAB, the installer mentions that new permissions were introduced and requires the user's permission. Once granted, it says that the app failed to install.

I've done some Googling and it appears to be a problem from their end, one user even tried to manually install an .apk with said permissions removed without any success. I wan't to make sure that it's not something I've done wrong, but an inevitability that I have to accept with some users.

Note that the vast majority has no problem of installing the app, and I haven't received any reports of this until after IAB was introduced. It wouldn't bother me so much were it a small amount of lost users, but the problem is, those users hurt my app's rating. Users have also mentioned that they can install apps, excluding my own, perfectly well.

I don't rule out the possibility that users may have been getting these errors even before IAB was introduced, and the linkage could be a mistaken one.

Here is my manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest package = "com.jjsoftware.fullscientificcalculator"
      xmlns:android = "">

<uses-permission android:name = "android.permission.VIBRATE"/>
<uses-permission android:name = ""/>

    android:allowBackup = "true"
    android:fullBackupContent = "true"
    android:icon = "@drawable/logo"
    android:label = "@string/app_name">
        android:name = ".MainActivity"
        android:hardwareAccelerated = "false"
        android:label = "@string/app_name"
        android:screenOrientation = "portrait"
            <action android:name = "android.intent.action.MAIN"/>
            <category android:name = "android.intent.category.LAUNCHER"/>
        android:name = ".SettingsActivity"
        android:theme = "@style/PreferencesTheme">
            <action android:name = ".SettingsActivity"/>
            <category android:name = "android.intent.category.PREFERENCE"/>

Here is the Gradle file:

apply plugin: ''

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.jjsoftware.fullscientificcalculator"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 102
        versionName "1.679"

    sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }

dependencies {
    compile ''
    compile ''
    compile ''
    compile files('libs/exp4j-0.4.5.jar')
    compile files('libs/EJML-core-0.28.jar')
    compile files('libs/EJML-dense64-0.28.jar')
    compile files('libs/Jama-1.0.3.jar')
    compile files('libs/EJML-simple-0.28.jar')

And, if need be, the top-level build:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
    dependencies {
        classpath ''

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files

allprojects {
    repositories {

Perhaps the error is on the user's side.

This article states the following:

Google Play - Error 504


App could not be downloaded due to an error.

First solution

The usual, please: go to Settings > Apps > All > Google Play Store and Clear cache and Clear data. Also Clear cache and Clear data for Google Services Framework.

Second solution

Try removing your GMail account

This Stack Exchange answer discussed similar ideas.

According to the list of status codes at Wikipedia, a 504 error means the following:

504 Gateway Timeout
The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.

Ask your users if doing the above solves their issue.

There is a typo in the manifest file on line android:largeHeap="true">>. xml line ends with >>. This may be causing the error.

it could be the phones have a lower version of the Google play services than the minimum you defined in the APK.

There is nothing much you can do if that is the case, other than for the users to upgrade their google services ( or you reduce your version.

also you may need to add the following to your manifest. (i think this is used to compare the versions installed in the phones with the versions required by the apk)

<application ...>

    <!-- This meta-data tag is required to use Google Play Services. -->
        android:value="@integer/google_play_services_version" />