Glide 4.6. 1 Resolution of issues that GlideApp cannot generate

  • 2021-08-28 20:58:07
  • OfStack

This article introduces the solution to the problem that Glide 4.6. 1 GlideApp cannot generate, and shares it with you as follows:

The dependency configuration is as follows

sdk build version of Glide 4.6. 1 must be > = 27, you must ensure that all support versions are the same and 27.1. 0


compile 'com.github.bumptech.glide:glide:4.6.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
  
compile 'com.android.support:support-annotations:27.1.0'
compile 'com.android.support:appcompat-v7:27.1.0'

Add the following code to the Application or module module

It should be noted in this place that @ GlideModule can't be less annotated. After adding the code, clean- > rebuild shows the following code:

app/build/generated/source/apt/debug/com/leo/GlideApp.java


package com.leo.app;
import android.content.Context;
import android.support.annotation.NonNull;
import com.bumptech.glide.Glide;
import com.bumptech.glide.GlideBuilder;
import com.bumptech.glide.Registry;
import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.module.AppGlideModule;
@GlideModule
public final class GlobalGlideConfig extends AppGlideModule {
  @Override
  public boolean isManifestParsingEnabled() {
//    return super.isManifestParsingEnabled();
    return false;
  }

  @Override
  public void applyOptions(@NonNull Context context, @NonNull GlideBuilder builder) {
    super.applyOptions(context, builder);
  }

  @Override
  public void registerComponents(@NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) {
    super.registerComponents(context, glide, registry);
  }
}

If you have more than one module in your project, you should put module into sdk to generate code so that other modules can use GlideApp if they rely on the sdk module.


Related articles: