Hello_Berial
Hello_Berial

Reputation: 81

Media Capabilities property not specified

I run ./gradlew :app:lint task to generate a report.

One of them is Media Capabilities property not specified

../../src/main/AndroidManifest.xml:6: The app accesses MediaStore.Video, but is missing a tag with a android.content.MEDIA_CAPABILITIES declaration

  3   xmlns:tools="http://schemas.android.com/tools"
  4   package="com.example.myapp">
  5 
  6   <application                                                                                      
  7     android:name=".App"
  8     android:allowBackup="false"
  9     android:icon="@mipmap/ic_launcher"

In Android 12 and higher, an app that opens media files should explicitly specify media formats that it doesn't support, so the OS can provide a transcoded file instead. To suppress this error, use the issue id "MediaCapabilities" as explained in the Suppressing Warnings and Errors section.

How to fix it?

Upvotes: 7

Views: 957

Answers (2)

Anigif
Anigif

Reputation: 997

We're getting the same warning and we don't have any video in our app - at least directly. I found this bug report, they state that it might be from a library you're using. Until a better solution has been made by Google I think the best would be to just ignore it (as suggested by Marius Kohmann) if you're certain you're not using video in your app.

Upvotes: 0

Marius Kohmann
Marius Kohmann

Reputation: 721

I am not using any media capabilities in my app, and will still get this lint issue.

I simply suppressed the error to "fix" it. Seems like a false positive with Android Lint.

<application
    tools:ignore="MediaCapabilities">
</application>

Upvotes: 6

Related Questions