Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Log file filled with attributionTag not declared in manifest

I've just noted that my logfile is filled with many entries

2025-07-31 10:56:31.326 1709-5052 AppOps system_server E attributionTag not declared in manifest of XXXX

2025-07-31 10:56:31.327 1709-2137 AppOps system_server E attributionTag not declared in manifest of XXXXX

I assume it is related to using the media player in my application and maybe it is related to Android 16 because I didn't see it in the past.

I don't undestand where this error comes from and I'm not using any tag like "attribution" in my manifest.

Using the media player is like:

mediaPlayer = MediaPlayer.create(context, alarmResourceId)

where alarmResourceId points to an ogg-file part of the resources under the raw directory.

I would like to know what I have to specify in my manifest to get rid of this error message.

like image 846
de11833 Avatar asked Oct 24 '25 03:10

de11833


2 Answers

I have encountered the same issue and thought the fix would be the following, but I can't manage to add it to the manifest (I target API 36 as well).
Getting error: "Element attribution is not allowed here" no matter where I put it.
https://developer.android.com/privacy-and-security/audit-data-access#declare-attribution-tags

Maybe you will have better luck...

like image 172
Liron Barzilai Avatar answered Oct 26 '25 15:10

Liron Barzilai


Declare this in your AndroidManifest.xml:

<attribution android:tag="audioPlayback" android:label="@string/audio_playback_attribution" />

Add the string in strtings.xml:

<string name="audio_playback_attribution">"This app plays audio"</string>

In you main activity create the attribution context:

Context audioAttributionContext = (Build.VERSION.SDK_INT >= 30) ?
   createAttributionContext("audioPlayback") :
   context;

Then use it when creating the media player:

mediaPlayer = MediaPlayer.create(audioAttributionContext, alarmResourceId);
like image 22
grebulon Avatar answered Oct 26 '25 15:10

grebulon