hubtwork
hubtwork-tech
hubtwork
전체 방문자
오늘
어제
  • 분류 전체보기 (2)
    • Algorithm (0)
    • Development (2)
      • Spring (0)
      • Node.js (0)
      • Android (2)
    • CS (0)
      • Network (0)
      • DB (0)

블로그 메뉴

    공지사항

    인기 글

    태그

    • glide
    • Android
    • junit5
    • 테스트
    • Kotlin
    • 안드로이드
    • image

    최근 댓글

    최근 글

    티스토리

    hELLO · Designed By 정상우.
    hubtwork

    hubtwork-tech

    Glide - GeneratedAppGlideModule Warning
    Development/Android

    Glide - GeneratedAppGlideModule Warning

    2022. 12. 15. 10:11

    Warning Case

    • 안드로이드 이미지 프로세싱 프레임워크인 Glide 사용 중 아래와 같은 Warning 이 확인됨.
    W/Glide: Failed to find GeneratedAppGlideModule. You should include an annotationProcessor compile dependency on co[m.github.bumptech.glide:compiler](http://m.github.bumptech.glide:compiler) in your application and a @GlideModule annotated AppGlideModule implementation or LibraryGlideModules will be silently ignored

    Reason

    • Glide 는 Application Context 에 붙은 하나의 GeneratedAppGlideModuleImpl 클래스를 생성해 사용하는데, 코틀린 베이스의 모듈에서는 자바에서 활용하는 것과 같이 컴파일이 안되어 해당 클래스를 찾을 수 없다고 경고함.

    Solution

    • @GlideModule Annotation 을 활용, 애플리케이션 내에 커스텀 글라이드 앱을 만들고 활용.

    1) Gradle Dependency 설정

    // build.gradle.kts
    plugins {
        // kotlin annotation processing tool 플러그인 추가
        kotlin("kapt")
    }
    ...
    dependencies {
        implementation("com.github.bumptech.glide:glide:4.14.2")
        kapt("com.github.bumptech.glide:compiler:4.14.2")
    }

    2) Glide API Extension 구현

    import com.bumptech.glide.annotation.GlideModule
    import com.bumptech.glide.module.AppGlideModule
    
    @GlideModule
    class HubtworkGlideModule: AppGlideModule()

    3) Rebuild Projects or Module
    모듈 재빌드 후 GlideApp 으로 Glide 대체해 사용시, 위에서 확장한 Extension 으로 Auto-Generated 된 GeneratedAppGlideModuleImpl 을 활용하기 때문에 Warning 이 더 이상 뜨지 않음.

    @JvmStatic
    @BindingAdapter("image")
    fun bindLoadImage(view: AppCompatImageView, url: String) {
        GlideApp.with(view.context)
            .load(url)
            .into(view)
    }

    References

    • Glide Implementation
    • Glide Configuration
    저작자표시 비영리 변경금지 (새창열림)

    'Development > Android' 카테고리의 다른 글

    [Android] Readable UnitTest - JUnit5  (1) 2022.11.24
      'Development/Android' 카테고리의 다른 글
      • [Android] Readable UnitTest - JUnit5
      hubtwork
      hubtwork
      @git : https://github.com/hubtwork

      티스토리툴바