【问题标题】:Missing support for Firebase App Indexing (android lint)缺少对 Firebase App Indexing 的支持(android lint)
【发布时间】:2016-03-14 09:58:07
【问题描述】:

在 Android 工作室分析我的代码(分析 > 检查代码)时,我收到此 lint 警告。

应用无法被 Google 搜索索引;考虑添加至少一个带有 ACTION-VIEW 意图填充的 Activity。有关详细信息,请参阅问题说明。

此警告是什么?如何使我的应用可被 Google 搜索索引? 这听起来对 SEO 很重要,但我在 Google 上找不到任何详细信息。

我也想知道如何从 android studio 访问“问题说明”。

编辑:

“应用程序无法被 Google 搜索索引”是旧警告。新的警告是 “缺少对 Firebase 应用索引的支持”

【问题讨论】:

    标签: android-studio permissions android-manifest warnings android-lint


    【解决方案1】:

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

    所以我缺少的关键字是“深层链接”!

    以下是android开发者页面做深度链接“让Google能够抓取你的应用内容并允许用户从搜索结果中进入你的应用”

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

    下面是关于如何做深度链接的代码sn-p。 我不知道谷歌如何通过添加它来抓取我的应用程序......

    <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>
    

    还有一个注释写着

    Note: Intent filters may only contain a single data element for a URI pattern. 
    Create separate intent filters to capture additional URI patterns.
    

    【讨论】:

    • 这是为您的应用配置深层链接。示例:如果用户在移动搜索上搜索与您的网络/应用程序匹配的特定关键字,它可以直接链接到您的意图,从而可以在您的应用程序中打开特定的活动/视图。简而言之,搜索会直接让用户在应用内打开。
    • @NageshSusarla,所以在上面的例子中,关键字是“gizmos”吗?
    • developers.google.com/app-indexing/android/app 有关于它的详细信息。在这种情况下,任何在您的页面中搜索结果中显示 example.com/gizmos 的关键字都将指向此意图。
    • 我不明白,我应该放什么??
    • 你必须有自己的网站才能添加吗?
    【解决方案2】:

    其实有两种方法可以处理“app is not indexable by google”问题。

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

      android {
      defaultConfig {
      // something
      }
      lintOptions {
      disable 'GoogleAppIndexingWarning'
      baseline file("lint-baseline.xml")
      }
      }
      

    【讨论】:

      【解决方案3】:

      您可以通过在&lt;intent-filter&gt; 内的&lt;activity&gt; 中添加以下代码来删除警告

              <action android:name="android.intent.action.VIEW" />
      

      【讨论】:

        【解决方案4】:

        如果您想在应用程序开发完成之前禁用此警告,或者如果您没有要添加的任何 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>
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2018-10-21
          • 1970-01-01
          • 2017-04-10
          • 2019-11-10
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多