最近真是遇到各种没遇见过的Warning啊,新建了项目,上来就是刺眼的警告,对于有代码洁癖的真是不友好啊,如下:
Warning: App is not indexable by Google Search; consider adding at least one Activity with an ACTION-VIEW intent filter. See issue explanation for more details.
官方说如是:
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.
大致意思是说:要使Google能够获取您的应用内容并允许用户从搜索结果中进入你的应用,必须为manifest中的相关Activity添加一个intent filters。允许深入连接到你的任何Activity中。例如,用户可以点击深层链接来查看购物应用中的页面,该页面描述用户正在搜索的产品。
更多关于 deep link:Create Deep Links to App Content
如何解决方法
1、添加intent-filter
在AndroidManifest.xml文件中,至少一个activity的intent-filter中添加
<action android:name="android.intent.action.VIEW" />
2、忽略警告
在app的build.gradle中添加下列代码:
lintOptions {
disable 'GoogleAppIndexingWarning'
}
Deeplink有什么用?
举例来说,当用户在其他应用或网页中点击了广告时,使用了Deeplink的商家APP,可以直接跳转到相应商品的界面;而没有使用Deeplink的APP,就只能跳转到首页。包括新闻APP的推送等等。