6

Building library module. And in the sample application which is using the library module it has

@GlideModule
class DPAppGlideModule : AppGlideModule() {
    override fun isManifestParsingEnabled(): Boolean {
        return false
    }
}

and in the library module has:

@GlideModule
public final class LibGlideModule extends LibraryGlideModule {
}

and in the library module it is using the GlideApp the generated api

fun ImageView.loadImg(imageUrl: String) {
var requestOptions : RequestOptions  = RequestOptions()
requestOptions.diskCacheStrategy(DiskCacheStrategy.ALL)
if (!TextUtils.isEmpty(imageUrl)) {
    GlideApp.with(this.context)
            .setDefaultRequestOptions(requestOptions)
            .load(imageUrl)
            .into(this)
}

}

But since this is the library module and cannot have decency on the application module, so it cannot compile

How to use the GlideApp generated api in the library module?

ref — https://bumptech.github.io/glide/doc/configuration.html

lannyf
  • 9,865
  • 12
  • 70
  • 152

1 Answers1

0

Just add

annotationProcessor com.github.bumptech.glide:compiler:4.8.0

dependency in your module gradle file. sync project then clean and rebuild it.

If your module using kotlin. change "annotationProcessor" to "kapt".

Be careful if you have others module dependency,make sure you use the right GlideApp Object. Maybe others module have it own GlideApp object

Rayman
  • 123
  • 1
  • 1
  • 9