【问题标题】:Instant app, Try Now button does not appear in play store即时应用程序,立即尝试按钮不会出现在 Play 商店中
【发布时间】:2021-05-01 06:15:06
【问题描述】:

我从以下 github 项目开始,但这些示例无法正常工作。我添加了文档中所述的缺失部分。 https://github.com/android/app-bundle-samples/tree/main/InstantApps/urlless https://github.com/googlecodelabs/android-dynamic-features

这是我阅读的文档。 https://developer.android.com/topic/google-play-instant/getting-started/instant-enabled-app-bundle https://developer.android.com/topic/google-play-instant/feature-module-migration https://developer.android.com/guide/app-bundle/instant-delivery

我尝试实现一个简单的 hello world 即时应用程序。我尝试了很多东西,但立即尝试按钮从未出现在 Play 商店中。

我的应用包含 2 个模块:

  • 应用程序
  • 即时应用

应用模块的build.gradle:

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 30
    defaultConfig {

        minSdkVersion 21
        targetSdkVersion 30
        versionCode 61
        versionName "61"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled true
            shrinkResources false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            debuggable true
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dynamicFeatures = [':instantapp']
}

dependencies {
    ...
    implementation "com.google.android.gms:play-services-instantapps:17.0.0"
    implementation "com.google.android.play:core:1.9.0"
    ...
}

我的即时应用模块的build.gradle

plugins {
    id 'com.android.dynamic-feature'
}
android {
    compileSdkVersion 30
    buildToolsVersion "30.0.2"

    defaultConfig {
        applicationId "com.test.myapp"
        minSdkVersion 21
        targetSdkVersion 30
        versionCode 3
        versionName "1.2"
    }
}

dependencies {
    
    implementation "com.google.android.play:core:1.9.0"
   
}

我的应用模块的AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest >

    <dist:module dist:instant="true" />

    ...

</manifest>

我的即时应用模块的AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:dist="http://schemas.android.com/apk/distribution"
    package="com.test.instantapp"
    android:targetSandboxVersion="2">

    <dist:module dist:instant="true" dist:onDemand="false"
        dist:title="Instant app title">
        <dist:fusing dist:include="true" />
    </dist:module>

    <application android:usesCleartextTraffic="false">
        <activity android:name=".InstantMainActivity">
            <intent-filter>
               <action android:name="android.intent.action.MAIN" />
               <category android:name="android.intent.category.LAUNCHER" />
           </intent-filter>
        </activity>
    </application>

  
</manifest>

我生成了一个签名包并在每次尝试中将其上传到内部测试中,但它不起作用。我也在产品环境中尝试过。不行!

我尝试将 applicationId "com.test.myapp" 放在应用程序模块和即时应用程序模块中。我尝试制作 android:targetSandboxVersion="2" 和 android:targetSandboxVersion="1"。不行 . 我的应用的版本代码大于我的免安装应用的版本代码,如下所示。

我删除了 clearTextTraffic 并添加了。不行!

有人说我将启用即时应用的代码投入生产并上传新的升级即时应用版本。我做到了,它也没有工作。

我尝试了许多我现在不记得的组合。但是现在尝试按钮永远不会出现。我找不到的缺失部分是什么?

instant-app 模块的最大尺寸有 3 种说法:

  • 4 mb
  • 10 兆
  • 15 兆字节 为什么源代码和文档冲突太多,而且 github 中没有工作代码?如果我在 Play 商店中没有看到工作示例,我会认为即时应用程序已死。

【问题讨论】:

    标签: android google-play android-instant-apps dynamic-feature-module


    【解决方案1】:

    打开Play商店->选择应用->打开高级设置->添加发布类型即时应用

    然后从仅即时应用选项上传您的即时应用:

    【讨论】:

    • 感谢您的解决方案。也许您可以将此标记为已接受的答案?对我来说,当我尝试按照描述进行部署时收到以下错误消息:“您应该在创建即时应用发布之前发布您的应用”。你碰到了吗? Tnx
    • 我接受了答案。能否请您支持我的问题和答案:) 可能您正在尝试从生产中上传它。您可以尝试使用内部测试上传它。
    • 我需要上传一次到“封闭测试”轨道,然后消息消失了(也在内部)
    猜你喜欢
    • 2021-03-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-17
    • 2019-12-01
    • 2020-11-11
    相关资源
    最近更新 更多