Unable to Resolve GlideApp in Glide 4.1.1

Bir Nepali :

After Going Through tons of forums about same issue, I still not been able to resolve the GlideApp error. It says it cannot be resolved. Here is the screenshot:

enter image description here

Here is the java class to use details from above

enter image description here

My build.gradle file already contains:

  compile 'com.github.bumptech.glide:glide:4.1.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.1.1'

Both and also I have class with below code:

import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.module.AppGlideModule;

@GlideModule
public final class CustomAppGlideModule extends AppGlideModule {
}

And I'm using this to to request for:

When I use Glide.with Then it Error says

enter image description here

But still it doesn't solve the problem.

IntelliJ Amiya :

Try with

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

DEMO

@GlideModule
public class FlickrGlideModule extends AppGlideModule {

  @Override
  public void applyOptions(@NonNull Context context, @NonNull GlideBuilder builder) {
    super.applyOptions(context, builder);
    builder.setDefaultRequestOptions(new RequestOptions().format(DecodeFormat.PREFER_ARGB_8888));
  }

  @Override
  public void registerComponents(@NonNull Context context, @NonNull Glide glide,
      @NonNull Registry registry) {
    registry.append(Photo.class, InputStream.class, new FlickrModelLoader.Factory());
  }

  // Disable manifest parsing to avoid adding similar modules twice.
  @Override
  public boolean isManifestParsingEnabled() {
    return false;
  }
}

Read AppGlideModule

FYI

Your loadImage method will be

public static void loadImage(Context ctx,RequestOptions glideRequests, String url, ImageView imageView) {
        loadImage(ctx,glideRequests, url, imageView, DiskCacheStrategy.ALL);
    }

    public static void loadImage(Context ctx,RequestOptions glideRequests, String url, ImageView imageView, DiskCacheStrategy diskCacheStrategy) {

                 Glide.with(ctx)
                    .applyDefaultRequestOptions(requestOptions.placeholder(R.drawable.ic_stub).error(R.drawable.ic_stub))
                    .asBitmap()
                    .load(url).into(imageView);
    }

Then

ImageUtil.loadImage(context,options,obj.getPhotoUrl(),avatarImageView);

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=94719&siteId=1