AndridManifest Warnings: App is not indexable by Google Search

问题描述

AndroidStudio在版本升级之后也给用户带来了一些原来不存在的问题,虽然说只是一些小毛病,但是强迫症患者实在是不能接受。这不今天就遇到这么个事情:在AndroidManifest文件中,整个<application>警告,如下图所示在这里插入图片描述
警告的完整内容如下

App is not indexable by Google Search; consider adding at least one Activity with an ACTION-VIEW intent filter.

先来看看谷歌官方给出的解释

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能够抓取您的应用内容并允许用户从搜索结果中输入您的应用,您必须为应用清单中的相关活动添加意图过滤器。 这些意图过滤器允许深入链接到您的任何活动中的内容。 例如,用户可以点击深层链接以查看购物应用中的页面,该页面描述用户正在搜索的产品。

解决方案

1、添加ACTION-VIEW intent filter

在Manifest文件中加入如下内容:

<action android:name=“android.intent.action.VIEW” />

此时Application部分代码变为如下内容:

<application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

问题解决

2、忽略警告(当然不支持大家这么做)

修改app目录下的build.gradle文件,添加如下内容:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.activitytest"
        minSdkVersion 25
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    lintOptions{
        disable 'GoogleAppIndexingWarning'
    }
}

其中

lintOptions{
    disable ‘GoogleAppIndexingWarning’
}

是为添加部分,修改之后原来的警告就不见啦:)
在这里插入图片描述
自此之前被落下的Android又重新捡起来啦!以后会给出进阶过程中所遇到的一些问题以及详细地解决方法,如果大家有什么问题的话也希望能在评论区展开,互相学习哇!希望大家多多关注支持!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值