求助App is not indexable by Google Search; consider adding at least one Activity with an ACTION-VIEW

AS升级后,发现原来的代码会生成报出一个:App is not indexable by Google Search; consider adding at least one Activity with an ACTION-VIEW的warning。

From official documentation :

To enable Google to crawl your app content and allow users to enter your app from search results, you must add intent filters for the relevant activities in your app manifest. These intent filters allow deep linking to the content in any of your activities. For example, the user might click on a deep link to view a page within a shopping app that describes a product offering that the user is searching for.

解决的办法是两个:

1,根据上面的提示,增加一个deeplink,在activity中增加如下代码:

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

第二种方法是在app的bulid.gradle 文件中增加下面几行代码来关闭检索的功能。

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

 https://stackoverflow.com/questions/34173545/missing-support-for-firebase-app-indexing-android-lint

发布了10 篇原创文章 · 获赞 11 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/u013323018/article/details/82835241
今日推荐