AGP 7.4.0 - When targeting Android 13 or higher, posting a permission requires holding the POST_NOTIFICATIONS
Description
Code: https://github.com/jaredsburrows/android-gif-example/pull/243
AGP 7.4.0+ brings in new lint checks
Repro
git clone github.com/jaredsburrows/android-gif-example
cd android-gif-example
git checkout pr/jaredsburrows/updates-1666632461
gradlew :app:lintDebug
Error:
Error: When targeting Android 13 or higher, posting a permission requires holding the POST_NOTIFICATIONS permission (usage from com.bumptech.glide.request.target.NotificationTarget) [NotificationPermission]
Explanation for issues of type "NotificationPermission":
When targeting Android 13 and higher, posting permissions requires holding
the runtime permission android.permission.POST_NOTIFICATIONS.
See: https://github.com/jaredsburrows/android-gif-example/actions/runs/3379144926/jobs/5610312788
I've tried updating to 7.4.0-beta04 and the gallery sample still seems to build successfully using ./gradlew build :samples:gallery. See https://github.com/sjudd/glide/tree/issue_4940
Any ideas on what else I need to do? The gallery sample targets sdk 33.
Still occurs in Gradle v7.6.
Might be a temporary fix, but adding a file [randomNameHere].xml in the root dir with the following content:
<?xml version="1.0" encoding="UTF-8" ?>
<lint>
<issue id="NotificationPermission">
<ignore regexp="com.bumptech.glide.request.target.NotificationTarget" />
</issue>
</lint>
and adding
lintOptions {
lintConfig = file("$rootDir/[randomNameHere].xml")
}
to the app module allows lint to ignore the problem (for now)
This issue keeps generating errors when I try to build my project... How do I fix it?
To solve the error, go to AndroidManifest.xml and add the Post Notifications permission as shown in the screenshot below: