如果我为动作PICK指定mimeType,则VIEW Intent过滤器上缺少URL错误 [英] Missing URL error on VIEW Intent filter if I specify mimeType for action PICK
问题描述
我有一个应用程序,可以使用来自不同来源的意图过滤器查看不同类型的视频文件.为了在尝试打开任何视频文件时始终允许该应用程序出现,我已将此代码放置在清单中
I have an app that could view different kinds of video files using intent filters from different sources. To allow the app to appears always as choice when I try to open whatever video file, I have placed this code in the manifest
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<action android:name="android.intent.action.PICK"/>
<data android:mimeType="video/*" />
</intent-filter>
因此我可以在主要活动中通过处理Uri的应用程序接收Uri.
So I can receive the Uri in the app handling It in the main activity.
尽管一切似乎都按预期进行,但每次我尝试编辑清单时,Android Studio都用红色下划线标记所有意向过滤器代码,并报告错误missing url
.
如果我删除<data android:mimeType="video/*" />
,错误消失了,但是如果我这样做,该应用程序不仅会显示为视频文件,而且还会显示为选择.
Although everything seems working as supposed, every time that I try to edit the manifest Android Studio marks all intent filter code with a red underline reporting the error missing url
.
The error disappears If I remove <data android:mimeType="video/*" />
but If I do this the app appears as choice not only for video files.
推荐答案
@AndreaF我有同样的问题.您可以禁止显示此警告.
@AndreaF I have tha same issue. You can just suppress this warning.
要抑制,请尝试以下操作:
To suppress try this:
<intent-filter tools:ignore="AppLinkUrlError">
<action android:name="android.intent.action.VIEW"/>
<action android:name="android.intent.action.PICK"/>
<data android:mimeType="video/*" />
</intent-filter>
将xmlns:tools ="http://schemas.android.com/tools"添加到您的初始清单标签中.
add xmlns:tools="http://schemas.android.com/tools" to your initial manifest tag if it's not already there.
这篇关于如果我为动作PICK指定mimeType,则VIEW Intent过滤器上缺少URL错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!