본문 바로가기
Android/Trouble Shoot

W/Glide : Failed to find GeneratedAppGlideModule

by jaesungLeee 2021. 7. 12.

Glide 라이브러리를 이용하여 이미지를 로드하다 보면 아래와 같은 Warning 문구를 볼 수 있다.

실제 어플리케이션을 Run 하는데 직접적인 영향을 끼치지는 않지만 왠지 모를 불편함을 느낄 수 도 있을 것 같아 해결 방법을 포스팅한다.

 

W/Glide: Failed to find GeneratedAppGlideModule. You should include an annotationProcessor compile dependency on com.github.bumptech.glide:compiler in your application and a @GlideModule annotated AppGlideModule implementation or LibraryGlideModules will be silently ignored

 

1. build.gradle (:app)

build.gradle에서 아래와 같이 수정해준다.

 

plugins {
    ...
    id 'kotlin-kapt'
    ...
}

...

dependencies {
    ...
    implementation 'com.github.bumptech.glide:glide:{LATEST_VERSION}'
    kapt "android.arch.lifecycle:compiler:{LATEST_VERSION}"
    kapt 'com.github.bumptech.glide:compiler:{LATEST_VERSION}'
    ...
}

 

2. Glide Module Class 생성

@GlideModule 이라는 Annotation을 포함하는 Empty Class를 생성해준다.

(나의 경우 '패키지 이름/Module/' 이라는 디렉토리를 생성하고 그 안에 Class를 생성함.)

 

package com.xxx.xxx.xxx

import com.bumptech.glide.annotation.GlideModule
import com.bumptech.glide.module.AppGlideModule

@GlideModule
class GlideModule : AppGlideModule() {
}

 

3. 코드 수정

이렇게 Glide Module Class를 생성하면 Glide 라이브러리를 사용하는 부분의 코드를 약간 수정해야 한다.

아래 예시는 ViewBinding을 이용하여 RecyclerView 구현 시 Glide 라이브러리로 이미지를 로딩할 때의 코드이다.

 

먼저 프로젝트를 리빌딩 해줘야 한다.

1. Build -> Clean Project

2. Build -> Rebuild Project

 

class AnyAdapter(val list : MutableList<ListDataClass>) : RecyclerView.Adapter<MyAdapter.Holder>() {

    inner class Holder (var binding : Binding) : RecyclerView.ViewHolder(binding.root) {
        fun bindItems(data : ListDataClass) {
            GlideApp
                .with(binding.root.context)
                .load(data.image)
                .centerCrop()
                .into(binding.imageView)
        }
    }
    
    ...
}

 

기존에 Glide.with ~~로 작성했던 코드를 GlideApp.with ~~로 수정해 준다.

 

이렇게 하면 Warning Message가 사라지게 된다.

 

 

Reference

https://yoon-dailylife.tistory.com/10

 

Android) Glide Module 에러 대처법

Failed to find GeneratedAppGlideModule. You should include an annotationProcessor compile dependency on com.github.bumptech.glide:compiler in your application and a @GlideModule annotated AppGlideMo..

yoon-dailylife.tistory.com