【问题标题】:Upload failed You should use both http and https as schemes for your web intent-filters上传失败您应该同时使用 http 和 https 作为您的网络意图过滤器的方案
【发布时间】:2017-06-19 01:37:48
【问题描述】:

上传失败

您应该同时使用 http 和 https 作为您的网络意图过滤器的方案。

我在将免安装应用上传到 Play 商店时收到此错误。我在 Manifest 中声明了 http 和 https 的意图过滤器,如下所示。

<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="http"
                    android:host="XXXX" />
            </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="https"
                    android:host="XXXX" />
            </intent-filter>

能否请您告诉我可能出了什么问题以及为什么在上传到 Play 商店时出现此错误?

【问题讨论】:

    标签: android intentfilter android-instant-apps


    【解决方案1】:

    尝试像这样声明IntentFilter

    <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="http" />
        <data android:scheme="https" />
        <data android:host="yourhost.ru" />
        <data android:pathPattern="/featurePath" />
    </intent-filter>
    

    【讨论】:

    • 我有同样的问题,无法上传免安装应用,按照描述更改 IntentFilter 后,我可以成功上传,但不幸的是我遇到了其他问题:无法推出免安装应用,请参阅stackoverflow.com/questions/44772959/…
    • 在将应用程序包 (.aab) 上传到 Play 商店时,我也遇到了同样的问题。我已经像你提到的那样声明了意图过滤器,但它并没有解决这个问题。这个问题还有什么可能的原因?
    【解决方案2】:

    你必须在同一个意图过滤器中定义两者

       <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:host="XXXX"
                android:scheme="http" />
    
            <data
                android:scheme="https"
                android:host="XXXX" />
        </intent-filter>
    

    【讨论】:

      【解决方案3】:

              <intent-filter android:autoVerify="true">
                  <action android:name="android.intent.action.VIEW" />
      
                  <category android:name="android.intent.category.DEFAULT" />
                  <category android:name="android.intent.category.BROWSABLE" />
      
                  <data
                      android:scheme="http"
                      android:host="XYZ"
                      android:pathPattern="/app" />
      
                  <data
                      android:scheme="https"
                      android:host="XYZ"
                      android:pathPattern="/app" />
              </intent-filter>
              <intent-filter>
                  <action android:name="android.intent.action.MAIN" />
      
                  <category android:name="android.intent.category.LAUNCHER" />
              </intent-filter>
              <meta-data
                  android:name="default-url"
                  android:value="https://XYZ/app" />
          </activity>
      

      遇到了同样的问题。上面的清单解决了我的问题

      【讨论】:

        【解决方案4】:

        不要在 Manifest 文件中自行更改意图过滤器代码。

        只需转到工具 > 应用链接助手,然后按照 1 到 4 的步骤操作即可。

        在第 1 步中,android studio 会自动将这些意图过滤器代码添加到您的清单文件中。

        (来源: Developer Documentation > Add Android App Links

        按照链接中的步骤操作。

        【讨论】:

          【解决方案5】:

          同意上一个答案,但还要在intent-filter中添加android:autoVerify="true"

          【讨论】:

            【解决方案6】:

            我做了上面提到的所有事情,但在我的基本模块清单中添加这些权限后终于摆脱了这个错误。

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

            【讨论】:

              猜你喜欢
              • 1970-01-01
              • 2011-04-12
              • 2016-05-24
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 2011-04-03
              • 2012-08-19
              • 2020-12-06
              相关资源
              最近更新 更多