glide icon indicating copy to clipboard operation
glide copied to clipboard

AGP 7.4.0 - When targeting Android 13 or higher, posting a permission requires holding the POST_NOTIFICATIONS

Open jaredsburrows opened this issue 3 years ago • 6 comments

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

jaredsburrows avatar Nov 02 '22 23:11 jaredsburrows

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.

sjudd avatar Dec 30 '22 02:12 sjudd

Still occurs in Gradle v7.6.

lawgimenez avatar Jan 14 '23 10:01 lawgimenez

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)

Dawid-Witkowski avatar Apr 13 '23 20:04 Dawid-Witkowski

This issue keeps generating errors when I try to build my project... How do I fix it?

jr20xx avatar May 27 '23 08:05 jr20xx

To solve the error, go to AndroidManifest.xml and add the Post Notifications permission as shown in the screenshot below:

image

emmanuelmuturia avatar Oct 07 '23 12:10 emmanuelmuturia