glide icon indicating copy to clipboard operation
glide copied to clipboard

i register a LibraryGlideModule in my library,but how can i use the API?

Open Carpten opened this issue 9 years ago • 8 comments

hi,when i register a LibraryGlideModule in my lib,it does not generate the GlideApp,how can i use the api in lib?

Carpten avatar Jun 28 '17 06:06 Carpten

same problem :/

DroidNinja avatar Aug 13 '17 10:08 DroidNinja

http://bumptech.github.io/glide/doc/generatedapi.html#getting-started

sjudd avatar Aug 14 '17 16:08 sjudd

Added all dependencies. When using AppGlideModule it is generating GlideApp but as I am using glide in a library, adding LibraryGlideModule not generating GlideApp class.

DroidNinja avatar Aug 14 '17 16:08 DroidNinja

Ah so to be clear, you cannot generate the GlideApp class in libraries, only in applications.

We could theoretically do so, but then you'd have a different GlideApp class per library which would make importing the correct one a challenge.

If you have some special need to use GlideApp in your library, let me know. Otherwise you should just use the non-generated Glide class. It should just have a slightly less convenient API.

sjudd avatar Aug 14 '17 17:08 sjudd

I am using that for now. But I just want to know How do we use LibraryGlideModule class because the documentation specifically mention, do not use AppGlideModule in your libraries. As I have used glide in one of open source libraries, I want to provide flexibility to use glide while developing with glide. Thanks.

DroidNinja avatar Aug 14 '17 17:08 DroidNinja

You can use LibraryGlideModule to register components automatically. It's only useful if you have components to register (like a networking library, or additional decoders or something similar). If you don't have components to register, you don't need a LibraryGlideModule.

Put another way, if you didn't need a GlideModule in your AndroidManifest.xml with Glide v3, you don't need a LibraryGlideModule with Glide v4. If you did need a GlideModule in Glide v3, you can directly translate your GlideModule into a LibraryGlideModule in v4.

sjudd avatar Aug 15 '17 00:08 sjudd

ahh..okay!! Thanks!

DroidNinja avatar Aug 15 '17 05:08 DroidNinja

@DroidNinja @Carpten I got the same issue My workaround is copying all generated files by Glide. Add them into a module, and add this module as dependence of App-module

All generated files:

CustomGlideModule
GeneratedAppGlideModuleImpl
GeneratedRequestManagerFactory
GlideApp
GlideOptions
GlideRequest
GlideRequests
OkHttpStreamFetcher
OkHttpUrlLoader

Good luck

hungntv avatar Jul 23 '21 04:07 hungntv