glide icon indicating copy to clipboard operation
glide copied to clipboard

Gradle lint error due to POST_NOTIFICATIONS permission required starting Android 13

Open ArcherEmiya05 opened this issue 3 years ago • 4 comments
trafficstars

4.13.2:

Running ./gradlew lint is failing due to missing permission in Glide. By the way why do Glide need to use Notification?

Glide load line / GlideModule (if any) / list Adapter code (if any):

Fetching images

Layout XML:

N/A

Stack trace / LogCat:

> Task :app:libs:AndroidFirebase:lintDebug FAILED
C:\Users\jense\.gradle\caches\transforms-3\72c1d08f8d878ae1ba2736907b26e15a\transformed\jetified-glide-4.13.2\jars\classes.jar: Error: When targeting Android 13 or higher, posting a pe
rmission 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.

1 errors, 0 warnings

ArcherEmiya05 avatar Jul 28 '22 16:07 ArcherEmiya05

Any solution for this? Thanks

ArcherEmiya05 avatar Jul 29 '22 15:07 ArcherEmiya05

NotificationTarget was a contribution that lets you add images to notifications. Neither it nor the permission are used unless you use that class.

There's a bunch of information on suppressing lint here: https://developer.android.com/studio/write/lint#config.

We could just suppress the warning for that class, it's probably not providing much value since it's only used if the caller is using notifications anyway.

sjudd avatar Aug 26 '22 15:08 sjudd

Hmm I also can't reproduce this when I build Glide or Glide's sample apps with target and compile sdk set to 33.

sjudd avatar Aug 26 '22 16:08 sjudd

Hmm I also can't reproduce this when I build Glide or Glide's sample apps with target and compile sdk set to 33.

I think the version of AGP and Gradle is also a factor to reproduce it

ArcherEmiya05 avatar Sep 14 '22 15:09 ArcherEmiya05

Duplicate of #4940

sjudd avatar Nov 13 '22 20:11 sjudd