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

时间:2015-12-09 07:59:43

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

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

  

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

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

我也想知道如何访问"问题解释"来自android studio。

enter image description here

修改

" Google搜索无法将应用程序转录为"是旧的警告。新的警告是 "缺少对Firebase应用程序索引的支持"

4 个答案:

答案 0 :(得分:104)

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

enter image description here

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

以下是用于执行深层链接的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>

还有一条说明

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

答案 1 :(得分:25)

实际上有2种方法可以处理&#39;应用程序无法通过Google进行索引。问题

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

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

答案 2 :(得分:17)

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

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

答案 3 :(得分:3)

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