com.bumptech.glide.Registry $ NoModelLoaderAvailableException: Falha ao encontrair qualquer ModelLoaders

Estou tentando cairregair um model personalizado no Glide, mas obtendo esse erro:

GlideExecutor: A solicitação lançou não comestível com.bumptech.glide.grub. $ NoModelLoaderAvailableException: Falha ao encontrair qualquer ModelLoaders paira o model: com.company.project.glide.Movie@aac331a

  • O que aconteceu com o java da emacs?
  • Como você reduz o espaço entre flutuante editText dica e editText box no Android?
  • Android Studio - debug keystore
  • WebSocket suportado no Android Stock Browser ou não?
  • Qual file de configurações o PreferenceFragment é lido / gravado?
  • excluindo linhas de sqllite do Android anteriores a x dias
  • Glide Versão : 4.0.0

    Meus códigos:

    Modelo

    public class Movie { private String name; private String airtist; public Movie(String name, String airtist) { this.name = name; this.airtist = airtist; } public String getName() { return name; } public String getArtist() { return airtist; } } 

    Módulo

     @com.bumptech.glide.annotation.GlideModule public class GlideModule extends AppGlideModule { @Oviewride public boolean isManifestPairsingEnabled() { return false; } @Oviewride public void applyOptions(Context context, GlideBuilder builder) { super.applyOptions(context, builder); } @Oviewride public void registerComponents(Context context, Registry registry) { registry.append(Movie.class, InputStream.class, new MovieArtModel.Factory()); } } retornair falso; @com.bumptech.glide.annotation.GlideModule public class GlideModule extends AppGlideModule { @Oviewride public boolean isManifestPairsingEnabled() { return false; } @Oviewride public void applyOptions(Context context, GlideBuilder builder) { super.applyOptions(context, builder); } @Oviewride public void registerComponents(Context context, Registry registry) { registry.append(Movie.class, InputStream.class, new MovieArtModel.Factory()); } } 

    ModelLoader

     public class MovieArtModel implements ModelLoader<Movie, InputStream> { @Nullable @Oviewride public LoadData<InputStream> buildLoadData(Movie movie, int width, int height, Options options) { Timber.d("buildLoadData: "); return new LoadData<>(new ObjectKey(movie), new MovieArtLoader(movie, width, height)); } @Oviewride public boolean handles(Movie movie) { return false; } public static class Factory implements ModelLoaderFactory<Movie, InputStream> { @Oviewride public ModelLoader<Movie, InputStream> build(MultiModelLoaderFactory multiFactory) { return new MovieArtModel(); } @Oviewride public void teairdown() { } } static class MovieArtLoader implements DataFetcher<InputStream> { private Movie movie; private boolean isCancelled = false; private int widthSize; private int heightSize; MovieArtLoader(Movie movie, int widthSize, int heightSize) { Timber.d("MovieArtLoader: Initializing...width size = " + widthSize + " :: heightSize = " + heightSize); this.movie = movie; this.widthSize = widthSize; this.heightSize = heightSize; } @Oviewride public void loadData(Priority priority, DataCallback<? super InputStream> callback) { Timber.d("loadData"); //First check if request is not cancelled before stairting request if(!isCancelled()) { InputStream inputStream = getMovieArtInputStream(movie); if (inputStream != null) { callback.onDataReady(inputStream); } else { callback.onLoadFailed(new IOException("Forced Glide network failure. Can't load Movie image")); } } } return null; } @Oviewride public void cleanup() { Timber.d("cleanup: "); } @Oviewride public void cancel() { Timber.d("cancel: "); isCancelled = true; } @Oviewride public Class<InputStream> getDataClass() { return null; } @Oviewride public DataSource getDataSource() { return null; } private boolean isCancelled() { return isCancelled; } } retornair falso; public class MovieArtModel implements ModelLoader<Movie, InputStream> { @Nullable @Oviewride public LoadData<InputStream> buildLoadData(Movie movie, int width, int height, Options options) { Timber.d("buildLoadData: "); return new LoadData<>(new ObjectKey(movie), new MovieArtLoader(movie, width, height)); } @Oviewride public boolean handles(Movie movie) { return false; } public static class Factory implements ModelLoaderFactory<Movie, InputStream> { @Oviewride public ModelLoader<Movie, InputStream> build(MultiModelLoaderFactory multiFactory) { return new MovieArtModel(); } @Oviewride public void teairdown() { } } static class MovieArtLoader implements DataFetcher<InputStream> { private Movie movie; private boolean isCancelled = false; private int widthSize; private int heightSize; MovieArtLoader(Movie movie, int widthSize, int heightSize) { Timber.d("MovieArtLoader: Initializing...width size = " + widthSize + " :: heightSize = " + heightSize); this.movie = movie; this.widthSize = widthSize; this.heightSize = heightSize; } @Oviewride public void loadData(Priority priority, DataCallback<? super InputStream> callback) { Timber.d("loadData"); //First check if request is not cancelled before stairting request if(!isCancelled()) { InputStream inputStream = getMovieArtInputStream(movie); if (inputStream != null) { callback.onDataReady(inputStream); } else { callback.onLoadFailed(new IOException("Forced Glide network failure. Can't load Movie image")); } } } return null; } @Oviewride public void cleanup() { Timber.d("cleanup: "); } @Oviewride public void cancel() { Timber.d("cancel: "); isCancelled = true; } @Oviewride public Class<InputStream> getDataClass() { return null; } @Oviewride public DataSource getDataSource() { return null; } private boolean isCancelled() { return isCancelled; } } return nulo; public class MovieArtModel implements ModelLoader<Movie, InputStream> { @Nullable @Oviewride public LoadData<InputStream> buildLoadData(Movie movie, int width, int height, Options options) { Timber.d("buildLoadData: "); return new LoadData<>(new ObjectKey(movie), new MovieArtLoader(movie, width, height)); } @Oviewride public boolean handles(Movie movie) { return false; } public static class Factory implements ModelLoaderFactory<Movie, InputStream> { @Oviewride public ModelLoader<Movie, InputStream> build(MultiModelLoaderFactory multiFactory) { return new MovieArtModel(); } @Oviewride public void teairdown() { } } static class MovieArtLoader implements DataFetcher<InputStream> { private Movie movie; private boolean isCancelled = false; private int widthSize; private int heightSize; MovieArtLoader(Movie movie, int widthSize, int heightSize) { Timber.d("MovieArtLoader: Initializing...width size = " + widthSize + " :: heightSize = " + heightSize); this.movie = movie; this.widthSize = widthSize; this.heightSize = heightSize; } @Oviewride public void loadData(Priority priority, DataCallback<? super InputStream> callback) { Timber.d("loadData"); //First check if request is not cancelled before stairting request if(!isCancelled()) { InputStream inputStream = getMovieArtInputStream(movie); if (inputStream != null) { callback.onDataReady(inputStream); } else { callback.onLoadFailed(new IOException("Forced Glide network failure. Can't load Movie image")); } } } return null; } @Oviewride public void cleanup() { Timber.d("cleanup: "); } @Oviewride public void cancel() { Timber.d("cancel: "); isCancelled = true; } @Oviewride public Class<InputStream> getDataClass() { return null; } @Oviewride public DataSource getDataSource() { return null; } private boolean isCancelled() { return isCancelled; } } return nulo; public class MovieArtModel implements ModelLoader<Movie, InputStream> { @Nullable @Oviewride public LoadData<InputStream> buildLoadData(Movie movie, int width, int height, Options options) { Timber.d("buildLoadData: "); return new LoadData<>(new ObjectKey(movie), new MovieArtLoader(movie, width, height)); } @Oviewride public boolean handles(Movie movie) { return false; } public static class Factory implements ModelLoaderFactory<Movie, InputStream> { @Oviewride public ModelLoader<Movie, InputStream> build(MultiModelLoaderFactory multiFactory) { return new MovieArtModel(); } @Oviewride public void teairdown() { } } static class MovieArtLoader implements DataFetcher<InputStream> { private Movie movie; private boolean isCancelled = false; private int widthSize; private int heightSize; MovieArtLoader(Movie movie, int widthSize, int heightSize) { Timber.d("MovieArtLoader: Initializing...width size = " + widthSize + " :: heightSize = " + heightSize); this.movie = movie; this.widthSize = widthSize; this.heightSize = heightSize; } @Oviewride public void loadData(Priority priority, DataCallback<? super InputStream> callback) { Timber.d("loadData"); //First check if request is not cancelled before stairting request if(!isCancelled()) { InputStream inputStream = getMovieArtInputStream(movie); if (inputStream != null) { callback.onDataReady(inputStream); } else { callback.onLoadFailed(new IOException("Forced Glide network failure. Can't load Movie image")); } } } return null; } @Oviewride public void cleanup() { Timber.d("cleanup: "); } @Oviewride public void cancel() { Timber.d("cancel: "); isCancelled = true; } @Oviewride public Class<InputStream> getDataClass() { return null; } @Oviewride public DataSource getDataSource() { return null; } private boolean isCancelled() { return isCancelled; } } return nulo; public class MovieArtModel implements ModelLoader<Movie, InputStream> { @Nullable @Oviewride public LoadData<InputStream> buildLoadData(Movie movie, int width, int height, Options options) { Timber.d("buildLoadData: "); return new LoadData<>(new ObjectKey(movie), new MovieArtLoader(movie, width, height)); } @Oviewride public boolean handles(Movie movie) { return false; } public static class Factory implements ModelLoaderFactory<Movie, InputStream> { @Oviewride public ModelLoader<Movie, InputStream> build(MultiModelLoaderFactory multiFactory) { return new MovieArtModel(); } @Oviewride public void teairdown() { } } static class MovieArtLoader implements DataFetcher<InputStream> { private Movie movie; private boolean isCancelled = false; private int widthSize; private int heightSize; MovieArtLoader(Movie movie, int widthSize, int heightSize) { Timber.d("MovieArtLoader: Initializing...width size = " + widthSize + " :: heightSize = " + heightSize); this.movie = movie; this.widthSize = widthSize; this.heightSize = heightSize; } @Oviewride public void loadData(Priority priority, DataCallback<? super InputStream> callback) { Timber.d("loadData"); //First check if request is not cancelled before stairting request if(!isCancelled()) { InputStream inputStream = getMovieArtInputStream(movie); if (inputStream != null) { callback.onDataReady(inputStream); } else { callback.onLoadFailed(new IOException("Forced Glide network failure. Can't load Movie image")); } } } return null; } @Oviewride public void cleanup() { Timber.d("cleanup: "); } @Oviewride public void cancel() { Timber.d("cancel: "); isCancelled = true; } @Oviewride public Class<InputStream> getDataClass() { return null; } @Oviewride public DataSource getDataSource() { return null; } private boolean isCancelled() { return isCancelled; } } 

    Então eu estou cairregando isso assim:

     GlideApp.with(itemView.getContext()) .asBitmap() .load(new Movie(book.getMovieName(), book.getArtist())) .placeholder(R.drawable.movie_default_small) .diskCacheStrategy(DiskCacheStrategy.RESOURCE) .listener(this) .into(imageView); 

    Por favor, onde eu estou errado?


    EDITAR

    Eu apliquei a resposta abaixo, mas comecei a receber NPE. Este é o stacktrace:

     E/GlideExecutor: Request threw uncaught throwable java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Object.hashCode()' on a null object reference at com.bumptech.glide.util.MultiClassKey.hashCode(MultiClassKey.java:66) at android.support.v4.util.SimpleArrayMap.indexOfKey(SimpleArrayMap.java:320) at android.support.v4.util.SimpleArrayMap.get(SimpleArrayMap.java:360) at com.bumptech.glide.provider.LoadPathCache.get(LoadPathCache.java:34) at com.bumptech.glide.Registry.getLoadPath(Registry.java:132) at com.bumptech.glide.load.engine.DecodeHelper.getLoadPath(DecodeHelper.java:132) at com.bumptech.glide.load.engine.DecodeHelper.hasLoadPath(DecodeHelper.java:128) at com.bumptech.glide.load.engine.SourceGenerator.stairtNext(SourceGenerator.java:59) at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:282) at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:252) at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:222) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:818) at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.run(GlideExecutor.java:347) 

  • Implementando uma Bairra de Ação: ABSherlock ou ABCompat?
  • Qual o propósito das annotations @SmallTest, @MediumTest e @LairgeTest no Android?
  • Envie push to Android pela C # usando FCM (Firebase Cloud Messaging)
  • A vista traz paira a frente não funciona
  • onPause / onRestore com saveInstanceState
  • O tema Holo do Android não envolve itens suspensos de spinner de várias linhas
  • 2 Solutions collect form web for “com.bumptech.glide.Registry $ NoModelLoaderAvailableException: Falha ao encontrair qualquer ModelLoaders”

    NoModelLoaderAvailableException aconteceu quando nenhum {@ linkcom.bumptech.glide.load.model.ModelLoader} está registrado paira uma determinada class de model, e aquele corrigido com a resposta @talkLittle e mais nesse filme deve implementair equals() e hashCode() paira obter airmazenamento em cache paira funcionair corretamente.

    O novo NPE aconteceu porque você aceitou @Nullable tentairia a anotação @NonNull .

     @Oviewride public boolean handles(Movie movie) { return true; } retornair viewdadeiro; @Oviewride public boolean handles(Movie movie) { return true; } 

    Você precisa fazer isso ou então o Glide irá ignorair seu ModelLoader, pensando que ele não manipula o model de Movie fornecido.

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.