缺少对Firebase应用程序索引的支持(​​android lint)

Ang*_*Koh 148 permissions warnings android-manifest android-lint android-studio

在分析Android工作室的代码(Analyze> Inspect Codes)时,我收到此lint警告.

Google搜索无法将应用程序编入索引; 考虑使用ACTION-VIEW意图填充添加至少一个活动.有关详细信息,请参阅问题说明

这是什么警告,以及如何通过Google搜索将我的应用程序编入索引?对SEO来说这听起来很重要,但我在Google上找不到任何细节.

我也想知道如何从android studio访问"问题解释".

在此输入图像描述

编辑:

"谷歌搜索无法将应用程序编入索引"是旧警告.新警告"缺少对Firebase应用程序索引的支持"

Ang*_*Koh 104

我发现了如何访问"问题解释".我需要将鼠标悬停在检查错误上以显示内联的完整问题说明(并按Ctrl-F1)

在此输入图像描述

所以我缺少的关键词是"深层链接"!

以下是用于执行深层链接的Android开发者页面"允许Google抓取您的应用内容并允许用户从搜索结果中输入您的应用"

http://developer.android.com/training/app-indexing/deep-linking.html

以下是有关如何进行深层链接的代码段.我不知道谷歌如何只是通过添加它来抓取我的应用程序...

<activity
    android:name="com.example.android.GizmosActivity"
    android:label="@string/title_gizmos" >
    <intent-filter android:label="@string/filter_title_viewgizmos">
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <!-- Accepts URIs that begin with "http://www.example.com/gizmos” -->
        <data android:scheme="http"
              android:host="www.example.com"
              android:pathPrefix="/gizmos" />
        <!-- note that the leading "/" is required for pathPrefix-->
        <!-- Accepts URIs that begin with "example://gizmos”
        <data android:scheme="example"
              android:host="gizmos" />
        -->
    </intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)

还有一个说明

Note: Intent filters may only contain a single data element for a URI pattern. 
Create separate intent filters to capture additional URI patterns.
Run Code Online (Sandbox Code Playgroud)

  • https://developers.google.com/app-indexing/android/app提供了有关它的详细信息.在这种情况下,导致您的网页在搜索结果中显示http://www.example.com/gizmos的任何关键字都会指向此意图. (6认同)
  • 您是否必须添加自己的网站? (6认同)
  • 我不明白,我应该放什么? (3认同)
  • 这用于配置深入链接到您的应用程序.示例:如果用户在移动搜索中搜索与您的网络/应用匹配的特定关键字,则可以直接链接到您的意图,该意图可以打开您应用内的特定活动/视图.简而言之,搜索将直接让用户在应用内打开. (2认同)

zkv*_*arz 26

实际上,有两种方法来处理'应用程序无法通过谷歌索引'问题.

  1. 如上所述,在应用中添加深层链接.
  2. 只需禁用lint警告.有时应用不会发布到Google Play,因此不需要如此深层次的链接等:

    android {
    defaultConfig {
    // something
    }
    lintOptions {
    disable 'GoogleAppIndexingWarning'
    baseline file("lint-baseline.xml")
    }
    }
    
    Run Code Online (Sandbox Code Playgroud)


Bib*_*hny 18

您可以通过在<intent-filter>里面添加以下代码来删除警告<activity>

        <action android:name="android.intent.action.VIEW" />
Run Code Online (Sandbox Code Playgroud)


Sha*_*nth 6

如果要在应用程序开发完成之前禁用此警告,或者如果没有要添加的Web URL,请在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.example.yourappname">

   <application
       ...
       ...
       tools:ignore="GoogleAppIndexingWarning">

          ....

   </application>

</manifest>
Run Code Online (Sandbox Code Playgroud)