【问题标题】:App does not install from Play Store on devices with Android 12 and above应用无法从 Play 商店安装到搭载 Android 12 及更高版本的设备上
【发布时间】:2023-02-16 17:52:51
【问题描述】:

我的应用程序遇到了以下问题 - 它无法在 Android 12 及更高版本的设备上从 Play Store 安装(帖子底部来自 Play Store 应用程序的错误对话框)。

这个问题是最近才出现的,推测是来自Google Play Store的31.9.13-21 [0] [PR] 467268234版本。

其他一些事实:

  • 在运行配置中使用选项“APK from app bundle”从 Android Studio 安装应用程序工作正常。
  • 从 Google Play 控制台安装通用 APK 工作正常。
  • 使用bundletool 安装 APK 工作正常。
  • 删除 Play 商店更新可以解决该问题。可以从 Play 商店应用程序设置中删除更新。

从 Play 商店安装时,Logcat 包含以下错误:INSTALL_FAILED_INVALID_APK:完整安装必须包含基础包.似乎这个错误是由 Android 系统的类抛出的,更具体地说是here(谷歌源)。据我了解,这意味着无效的 apk 集是从 bundle 中生成的,没有主(或基本 apk)。

App模块的build.gradle.ktssn-p(无依赖):

plugins {
    id("com.android.application")
    kotlin("android")
    id("kotlin-parcelize")
    id("com.google.gms.google-services")
    id("com.google.firebase.crashlytics")
    id("google-play-publisher")
    id("appcenter")
    id("com.huawei.agconnect")
    id("app-gallery-publisher")
}

android {
    compileSdk = 31

    defaultConfig {
        applicationId = "com.some.example"
        minSdk = 24
        targetSdk = 30
        versionCode = Versions.versionCode
        versionName = Versions.versionName
        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

        ndk {
            abiFilters.addAll(setOf("armeabi-v7a", "x86", "arm64-v8a", "x86_64"))
        }
    }

    compileOptions {
        sourceCompatibility(JavaVersion.VERSION_11)
        targetCompatibility(JavaVersion.VERSION_11)
    }

    kotlinOptions {
        jvmTarget = "11"
    }

    buildTypes {
        getByName("release") {
            isShrinkResources = true
            isMinifyEnabled = true
            proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
            proguardFiles(*fileTree("$rootDir/proguard").files.toTypedArray())
            signingConfig = signingConfigs.getByName("release")
        }
        getByName("debug") {
            signingConfig = signingConfigs.getByName("debug")
        }
    }

    packagingOptions {
        exclude("META-INF/LICENSE.md")
        exclude("META-INF/LICENSE-notice.md")
    }

    buildFeatures {
        viewBinding = true
    }

    bundle {
        language {
            enableSplit = false
        }
    }
}

应用模块的AndroidManifest.xml

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

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission
        android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
        tools:node="remove"
        tools:ignore="ScopedStorage"/>

    <application
        android:name="AppName"
        android:allowBackup="false"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:networkSecurityConfig="@xml/network_security_config"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        tools:replace="android:allowBackup">
        <activity
            android:name="SomeActivityName"
            android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <category android:name="android.intent.category.BROWSABLE"/>
                <data android:scheme="somescheme"/>
            </intent-filter>
            <intent-filter android:autoVerify="true" tools:targetApi="m">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data
                    android:scheme="https"
                    android:host="some.host"
                    android:pathPrefix="/prefix" />
                <data
                    android:scheme="https"
                    android:host="some.host"
                    android:path="/path/"/>
            </intent-filter>
        </activity>
    </application>
</manifest>

【问题讨论】:

  • 01. 尝试在 Android Studio 的 Android 12 设备上运行它。 02. 发布你的Manifest.xml
  • 01. 从 Android Studio(使用应用程序包)在 Android 12 上运行应用程序没有任何问题。 02.完成
  • 您似乎暗示这是 Play 商店错误。如果是这样的话,联系 Play 开发者支持可能会更有用。
  • @Pierre 已经完成了:) issuetracker.google.com/issues/244621253。我只是想在这里引起更多关注。

标签: android google-play apk android-app-bundle android-12


【解决方案1】:

在 build.gradle.kts 文件中将 compileSdk 和 targetSdk 更新为 33。

【讨论】:

    猜你喜欢
    • 2012-05-20
    • 2015-02-21
    • 2021-12-31
    • 1970-01-01
    • 1970-01-01
    • 2022-11-21
    • 1970-01-01
    • 2021-02-11
    • 2017-07-15
    相关资源
    最近更新 更多