Android App用户在尝试更新时获取"Ap​​p not installed"

dae*_*dog 19 android android-manifest apk android-gradle-plugin

更新:对于询问用户正在接收哪些错误代码的人:没有错误代码.它只是打开一个空白的安装后页面,上面写着"应用程序未安装",旁边有一个大的"X".不同版本的Android可能会有不同的消息.没有迹象表明安装过程中出了什么问题.

更新2:一些用户报告说,当他们尝试从Play商店安装/更新时收到错误代码"-504",并在手动尝试安装.apk时收到"app not installed"消息.我不知道这个错误与无法安装的用户有什么关联,但是关于这个主题的关于SO的仅有2个问题的解决方案并没有为我解决任何问题.我已经包含了更新的清单和构建文件.

更新3:用户在成功安装IAB后在版本中报告此问题,这进一步证明了此问题是由引入IAB引起的概念的合法化.

更新4:看起来问题是旧用户尝试更新到新版本,而不是新用户.考虑到这一点,此问题很可能是INSTALL_FAILED_UID_CHANGED的结果.浏览版本历史记录,我在用户无法更新的有问题版本中所做的重大更改是删除我不再打算使用的drawable.

要求用户通过程序来解决这个问题并不合理.如果有一个我可以强制执行的解决方案可以解决有缺陷的用户,那就太好了......如果没有,那么我现在能做的最少就是损害控制并确保将来不会发生这种情况.

注意:以下是原始帖子推测问题是将IAB引入应用程序的结果.从那时起,它变得越来越不可能成为原因.无论如何,该帖子仍然有相关信息.

------------------------------------------------------------------------------------------

原标题:Android App用户在介绍IAB后获取"Ap​​p not installed"

我最近在我的应用程序中介绍了IAB,该应用程序已在Google Play上发布.过了一段时间,我开始从一些用户那里得到报告,当他们尝试安装或更新它时,他们会收到"安装失败"错误.让我觉得引入IAB的原因是,一位特定的长期用户通过电子邮件告诉我,当他尝试使用IAB更新到版本时,安装程​​序会提到引入了新的权限并需要用户的许可.一旦被授予,它表示应用程序无法安装.

我做了一些谷歌搜索,它似乎是一个问题从他们的结束,一个用户甚至试图手动安装.apk删除所述权限没有任何成功.我不确定这不是我做错了什么,而是我必须接受一些用户的必然性.

请注意,绝大多数都没有安装应用程序的问题,直到IAB推出之后我才收到任何报告.如果少量丢失的用户不会打扰我,但问题是,那些用户损害了我的应用程序的评级.用户还提到他们可以完全安装应用程序,不包括我自己的应用程序.

我不排除用户在引入IAB之前可能已经出现这些错误的可能性,并且链接可能是错误的.

这是我的清单:

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

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

<application
    android:allowBackup = "true"
    android:fullBackupContent = "true"
    android:icon = "@drawable/logo"
    android:label = "@string/app_name">
    <activity
        android:name = ".MainActivity"
        android:hardwareAccelerated = "false"
        android:label = "@string/app_name"
        android:screenOrientation = "portrait"
        android:theme="@style/AppTheme">
        <intent-filter>
            <action android:name = "android.intent.action.MAIN"/>
            <category android:name = "android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>
    <activity
        android:name = ".SettingsActivity"
        android:theme = "@style/PreferencesTheme">
        <intent-filter>
            <action android:name = ".SettingsActivity"/>
            <category android:name = "android.intent.category.PREFERENCE"/>
        </intent-filter>
    </activity>
</application>
Run Code Online (Sandbox Code Playgroud)

这是Gradle文件:

apply plugin: 'com.android.application'

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 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.google.android.gms:play-services-ads:8.4.0'
    compile 'com.android.support:gridlayout-v7:23.2.1'
    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')
}
Run Code Online (Sandbox Code Playgroud)

并且,如果需要,顶级构建:

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

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'

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

allprojects {
    repositories {
        jcenter()
    }
}
Run Code Online (Sandbox Code Playgroud)

Mic*_*rla 0

请记住,最新版本的 Android(Marshmallow 版本)已更改权限,为用户提供更多访问权限。因此,仅在清单中定义权限是不够的。

通过代码,您需要确保用户在使用应用程序时启用了计费权限。解决此问题的最简单方法是将目标 SDK 设置为 v-22。这应该可以暂时解决您的问题。

然而,真正的解决方案是处理 Marshmallow 中引入的新权限。操作方法如下:

@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {

    switch(requestCode) {
        case BILLING_REQUEST:
            if (canAccessBilling()) {
                callBillingPerms();
            }
            break;
    }
}

private void callBillingPerms() {
    Toast.makeText(this, "We need your permission to access Billing", Toast.LENGTH_SHORT).show();
}

private boolean canAccessSMS() {
    return(hasPermission(Manifest.vending.BILLING));
}

@TargetApi(Build.VERSION_CODES.M)
private boolean hasPermission(String perm) {
    return(PackageManager.PERMISSION_GRANTED==this.checkSelfPermission(perm));
}
Run Code Online (Sandbox Code Playgroud)

希望这可以帮助 :)