Android Studio——warning:App is not indexable by Google Search

今天在新建一个Activity之后,进入到AndroidManifest.xml文件,发现<application>标签的代码一片黄色,原来是发出warning了。(这个warning其实对于app的运行没有影响,但是看着总觉得不顺眼,就看看有啥解决办法没)

问题:

警告信息:

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.

应用无法通过Google搜索进行索引,请考虑添加至少一个带有ACTION-VIEW 的Intent过滤器的活动。 请参阅问题说明以获取更多详细信息

在点了more..之后出现了详细信息

inspection info:Adds URLs to get your app into the Google index, to get installs and traffic to your app from Google Search.

检查信息:添加URL来使你的应用进入Google索引,从Google搜索获取安装和对您应用的访问量。

解决方法(亲测有效):

方法一:

如果你想禁用这个warning,那么可以在app目录下的build.gradle的android{}中添加如下代码

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

并点击弹出的Sync now即可。

方法二:

忽略GoogleAppIndexingWarning

在鼠标点击了发出warning的区域后,代码行左边会出现一个黄色的小灯泡,点击后会出现几个选项

点击第一个选项后会自动在<manifest>标签中添加代码:

 xmlns:tools="http://schemas.android.com/tools"

并且在<application>标签中自动添加以下代码:

tools:ignore="GoogleAppIndexingWarning"

方法三:

根据警告信息说添加至少一个带有ACTION-VIEW 的Intent过滤器的活动,在activity的<intent-filter>标签中添加如下代码

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

并点击Sync Now即可,如下图

 

参考网站:stackoverflow

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值