Glide: Cannot resolve symbol 'GlideApp'

Created on 18 May 2017  路  38Comments  路  Source: bumptech/glide

I'm trying to use glide 4.0.0-RC0 by Gradle:

dependencies {
    compile 'com.android.support:appcompat-v7:25.1.0'
    compile 'com.caverock:androidsvg:1.2.2-beta-1'
    compile 'com.github.bumptech.glide:glide:4.0.0-RC0'
    compile 'com.android.support:support-v4:25.3.1'
}

I followed the example here: https://github.com/bumptech/glide/tree/master/samples/svg/src/main/java/com/bumptech/glide/samples/svg
but after add glide by Gradle, I got error: Cannot resolve symbol 'GlideApp'
My source:

package com.example.quangson.glidesvg;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import static com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions.withCrossFade;

import android.content.ContentResolver;
import android.graphics.drawable.PictureDrawable;
import android.net.Uri;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.bumptech.glide.RequestBuilder;
import com.example.quangson.glidesvg.glide.SvgSoftwareLayerSetter;

public class MainActivity extends AppCompatActivity {

    private static final String TAG = "SVGActivity";

    private ImageView imageViewRes;
    private ImageView imageViewNet;
    private RequestBuilder<PictureDrawablerequestBuilder;
    LinearLayout ll;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        imageViewNet = (ImageView) findViewById(R.id.svg_image_view2);

        requestBuilder = GlideApp.with(this)
                .as(PictureDrawable.class)
                .placeholder(R.drawable.image_loading)
                .error(R.drawable.image_error)
                .transition(withCrossFade())
                .listener(new SvgSoftwareLayerSetter());

        Uri uri = Uri.parse("http://www.clker.com/cliparts/u/Z/2/b/a/6/android-toy-h.svg");
        requestBuilder.load(uri).into(imageViewNet);
    }
}

Please help

question v4

Most helpful comment

same issue: Cannot resolve symbol 'GlideApp'

Added all dependencies and annotationProcessor and @GlideModule and it still does not work.

Seems this lib is not awesome anymore.

All 38 comments

You need to add the annotationProcessor dependency:

annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC0'

You also need to add an AppGlideModule. See the generated API documentation for details.

@sjudd I've stumbled on this one as well, somehow with readme reading, @GlideModule part is skipped. Maybe it'd be useful to add it as part of the readme for v4. Just a suggestion :).

I have the same problem, but my code contains all necessary dependencies
compile "com.github.bumptech.glide:glide:4.0.0-RC1"
annotationProcessor "com.github.bumptech.glide:compiler:4.0.0-RC1"
compile "com.github.bumptech.glide:okhttp3-integration:4.0.0-RC1"
compile 'com.android.support:support-v4:25.3.1'
and

@GlideModule
public class MyGlideModule  extends AppGlideModule

Android Studio 2.3.3, Gradle 3.5.5, Android Gradle 2.3.3.

I've read other issues but didn't find anything helpful there.

Hi,
i had the same problem and found out, that the plugin 'com.neenbedankt.android-apt' causes the problem.
When i removed this plugin and use annotationprocessor for all apt dependencies it works and GlideApp was generated.
Maybe it helps someone else too.

@MichaelHader i also do it,but it's still not generate glideapp

In my case I am using Android Studio 3.0 beta2 in app build.gradle I have

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

I have to use kapt 'com.github.bumptech.glide:compiler:4.0.0' instead of annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0'

If compiler does not work you should probably see an warning in the LogCat with Glide tag
Failed to find GeneratedAppGlideModule. You should include an annotationProcessor compile dependency on com.github.bumptech.glide:glide:compiler in your application and a @GlideModule annotated AppGlideModule implementation or LibraryGlideModules will be silently ignored

same issue: Cannot resolve symbol 'GlideApp'

Added all dependencies and annotationProcessor and @GlideModule and it still does not work.

Seems this lib is not awesome anymore.

Same issue here
I'm using Kotlin and update with kapt 'com.github.bumptech.glide:compiler:4.0.0'
and already add annotation @GlideModule but GlideApp was not generated

Hi all,
I found solution for this case,
I'm using Android Studio 3.0 Canary version so I need to include apply plugin: 'kotlin-kapt' in app gradle
You can see more detail at here:
https://kotlinlang.org/docs/reference/kapt.html

@kenk11 The only solution that worked! Thanks mate.
And this -> http://bumptech.github.io/glide/doc/getting-started.html

is a joke.
You are making big change in a library that is used by half of android world and you can't even do a proper explaination.

Yeah, do a module class, and you're done. Bs. Where do I put this class? Can it be in some kotlin file alongside other classes? Does it need any contents or must be empty? What are the benefits of new system? What particular errors mean and how to solve them?

@ljaniszewski

... is a joke. You are making big change in a library that is used by half of android world and you can't even do a proper explaination.

don't need that tone... it is open source and most of the maintenance and support is done in free time. Feel free to contribute a better documentation: http://bumptech.github.io/glide/dev/contributing.html#documentation

Where do I put this class? Does it need any contents or must be empty?

Have you opened "See Glide鈥檚 generated API page for more information."? http://bumptech.github.io/glide/doc/generatedapi.html#kotlin

What are the benefits of new system?

http://bumptech.github.io/glide/doc/generatedapi.html#about
http://bumptech.github.io/glide/doc/migrating.html#generated-api

What particular errors mean and how to solve them?

I think GitHub issues already cover most of them. As far as I remember the resolution was always a missing step from these linked pages.

The only solution that worked!

I think your case is also similar, you missed a step at http://bumptech.github.io/glide/doc/generatedapi.html#kotlin where it links to https://kotlinlang.org/docs/reference/kapt.html

@ljaniszewski

You are making big change in a library that is used by half of android world and you can't even do a proper explaination.

Lol I just share my solution and take a brief
Why you are too serious ?

@kenk11 Thank you for pointing this out. I've now submitted with a PR to include this in the docs, looks like it'll be in v4.2.

@DCRichards your welcome :)

Same issue with me , it worked fine with me in previous project , but in this project i am facing this issue

i am using all dependencies

compile 'com.github.bumptech.glide:glide:4.3.1'
compile 'com.github.bumptech.glide:annotations:4.3.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.3.1'

also included glide module

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

@GlideModule
public final class MyAppGlideModule extends AppGlideModule {

}

Tried clean,rebuild,make ,project, also did invalidate cache and restart but the issue still exists,
is there any thing else i can do ? As this issue is closed i am hoping there is some solution to it .

I like the old glide where we added only 1 dependency and worked perfectly fine.

Ok found out the cause after an hour of struggle . There was another issue in my project so my project was unable to build successfully , so GlideApp was not built hence showing this error . All the errors at the starting were of GlideApp and main error was hiding somewhere in the middle .

So guys if you did every thing i mentioned above and still getting this error the please check if there is some other issue in the project which is stopping build.

@Redman1037 I've noticed that Android Studio 3.x is quite selective with its error output, I'd recommend using the command line and inspecting the more verbose output. it's saved me on numerous occasions.

鎴戦亣鍒颁竴绫昏繖闂锛屽叾瀹炴槸鍚庨潰鍑虹幇鐨勯敊璇紩璧风殑杩欎釜鎻愮ず锛屼粎浠呮槸鏄剧ず鍦ㄥ墠闈紝浠ヤ负鏄疓lideApp鐨勯敊璇紝鍏跺疄鏄悗闈㈢殑閿欒

for anyone who is still facing this issue:
in my case I had the

implementation 'com.github.bumptech.glide:glide:4.4.0'
in my library module's build.gradle and the

kapt 'com.github.bumptech.glide:compiler:4.4.0'

inside my application module's build.gradle and the GlideApp class was not generated.

I ended up with having both dependencies inside my application module's build.gradle file!

For those experiencing this issue, also make sure annotationProcessor 'com.github.bumptech.glide:compiler:4.X.X is added to module level build.gradle

Other dependencies use annotationProcessor like butterknife may casue this problem. So check out other annotations' correctness first may be help.
e.g. I used butterknife and used @BindView(R.id.xx) but haven't the View to be bind under this code. delete this annotation then clean and make project will be useful.

Just Make a class in your project after this just to clean your project.

package com.akshay.utils;

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

@GlideModule
public final class MyAppGlideModule extends AppGlideModule {}

This is the only answer the solved my this issue for me - https://stackoverflow.com/a/46638213

This configuration worked for me -

  • In app module gradle -
    implementation "com.github.bumptech.glide:glide:${glide_version}"
    implementation "com.github.bumptech.glide:okhttp3-integration:${glide_version}"
    kapt "com.github.bumptech.glide:compiler:${glide_version}"
  • In app proguard -
-keep public class * extends com.bumptech.glide.module.AppGlideModule
-keep class com.bumptech.glide.GeneratedAppGlideModuleImpl
  • My Custom Glide module class -
package com.github.iamutkarshtiwari.glidedemoapp;

import android.content.Context;

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.integration.okhttp3.OkHttpUrlLoader;
import com.bumptech.glide.load.model.GlideUrl;
import com.bumptech.glide.module.AppGlideModule;

import java.io.InputStream;

import okhttp3.OkHttpClient;

@GlideModule
public final class OkHttp3GlideModule extends AppGlideModule {

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

    @Override
    public void registerComponents(Context context, Glide glide, Registry registry) {
        OkHttpClient client = new OkHttpClient.Builder()
                .build();

        OkHttpUrlLoader.Factory factory = new OkHttpUrlLoader.Factory(client);

        glide.getRegistry().replace(GlideUrl.class, InputStream.class, factory);
    }
}

Note-

  • Glide 4.0 need not have "GlideModule" declaration in AndroidMinifest.xml
  • You need to Make project in order to generate GlideApp class

In my case, i had another problem unrelated with GlideApp but also a single fail on compile causing fail on GlideApp too. Anyway, glideapp fills all error list and for javac there is a limit for printed errors and it's 50 by default. In this case it was not possible to see what is real problem for me. This is the solution for me to catch real issue.

allprojects {
    repositories {
        jcenter()
    }

    gradle.projectsEvaluated {
        tasks.withType(JavaCompile) {
            options.compilerArgs << "-Xmaxerrs" << "1000"
        }
    }
}

With this config Android Studio can list till 1000 error and you can see real error at the end of list usually. It was my 376th error :) . Rest was fake GlideApp errors. Yes, i have 375 different class which imports GlideApp, haha.

Tried just about everything on multiple different SO questions to solve this issue. GlideApp is still not generating. This entire approach just seems like bad design to me and the fact so many people are having a problem is worrying.

I tried to use Glide 4.80 and stuck for a few days, even after following download & setup page.
Clean project, make project didn't work.

finally, works after deleted build directory and rebuild.

Hello everyone,

Seems like great discussion going on. Don't worry. I have solution.

Follow the steps:

  • Add dependency as follow (I used latest version)
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
  • Create package (as I always used structured code) myglide and copy/paste following class:
@GlideModule
public class SampleGlideModule extends AppGlideModule {
    @Override
    public void applyOptions(@NonNull Context context, @NonNull GlideBuilder builder) {
        super.applyOptions(context, builder);
    }
}
  • Now you can press CTRL+F9 OR you can click on Make Project option in Build menu. It will _generate one file automatically_ (You can see by pressing CTRL and hover on ClassName in File.
final class GeneratedAppGlideModuleImpl extends GeneratedAppGlideModule {
  private final SampleGlideModule appGlideModule;
  ....
}

Now you can use GlideApp very easily. :100:

Hope it will helps you.

I love Glide as always. <3

@pratikbutani

Hello everyone,

Seems like great discussion going on. Don't worry. I have solution.

Follow the steps:

  • Add dependency as follow (I used latest version)
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
  • Create package (as I always used structured code) myglide and copy/paste following class:
@GlideModule
public class SampleGlideModule extends AppGlideModule {
    @Override
    public void applyOptions(@NonNull Context context, @NonNull GlideBuilder builder) {
        super.applyOptions(context, builder);
    }
}
  • Now you can press CTRL+F9 OR you can click on Make Project option in Build menu. It will _generate one file automatically_ (You can see by pressing CTRL and hover on ClassName in File.
final class GeneratedAppGlideModuleImpl extends GeneratedAppGlideModule {
  private final SampleGlideModule appGlideModule;
  ....
}

Now you can use GlideApp very easily.

Hope it will helps you.

I love Glide as always. <3

Gradle sync failed: Could not resolve all dependencies for configuration ':MyProject:x86DebugRuntimeClasspath'.
Could not determine artifacts for com.github.bumptech.glide:glide:4.8.0
Could not get resource 'https://jcenter.bintray.com/com/github/bumptech/glide/glide/4.8.0/glide-4.8.0.aar'.
Could not HEAD 'https://jcenter.bintray.com/com/github/bumptech/glide/glide/4.8.0/glide-4.8.0.aar'.
Connect to d29vzk4ow07wi7.cloudfront.net:443 [d29vzk4ow07wi7.cloudfront.net/143.204.194.185, d29vzk4ow07wi7.cloudfront.net/143.204.194.28, d29vzk4ow07wi7.cloudfront.net/143.204.194.133, d29vzk4ow07wi7.cloudfront.net/143.204.194.97] failed: Read timed out
Read timed out
Consult IDE log for more details (Help | Show Log) (2 m 12 s 770 ms)

When I use your solution, andorid studio get this error log... have you even been have this error before?

@pratikbutani

Hello everyone,
Seems like great discussion going on. Don't worry. I have solution.
Follow the steps:

  • Add dependency as follow (I used latest version)
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
  • Create package (as I always used structured code) myglide and copy/paste following class:
@GlideModule
public class SampleGlideModule extends AppGlideModule {
    @Override
    public void applyOptions(@NonNull Context context, @NonNull GlideBuilder builder) {
        super.applyOptions(context, builder);
    }
}
  • Now you can press CTRL+F9 OR you can click on Make Project option in Build menu. It will _generate one file automatically_ (You can see by pressing CTRL and hover on ClassName in File.
final class GeneratedAppGlideModuleImpl extends GeneratedAppGlideModule {
  private final SampleGlideModule appGlideModule;
  ....
}

Now you can use GlideApp very easily.
Hope it will helps you.
I love Glide as always. <3

Gradle sync failed: Could not resolve all dependencies for configuration ':MyProject:x86DebugRuntimeClasspath'.
Could not determine artifacts for com.github.bumptech.glide:glide:4.8.0
Could not get resource 'https://jcenter.bintray.com/com/github/bumptech/glide/glide/4.8.0/glide-4.8.0.aar'.
Could not HEAD 'https://jcenter.bintray.com/com/github/bumptech/glide/glide/4.8.0/glide-4.8.0.aar'.
Connect to d29vzk4ow07wi7.cloudfront.net:443 [d29vzk4ow07wi7.cloudfront.net/143.204.194.185, d29vzk4ow07wi7.cloudfront.net/143.204.194.28, d29vzk4ow07wi7.cloudfront.net/143.204.194.133, d29vzk4ow07wi7.cloudfront.net/143.204.194.97] failed: Read timed out
Read timed out
Consult IDE log for more details (Help | Show Log) (2 m 12 s 770 ms)

When I use your solution, andorid studio get this error log... have you even been have this error before?

No, I never ever got this type of error. I am using latest version of Android Studio.

Same question happened when i update android studio to v3.2.1, but GlideApp works fine in android studio v2.3.0 with same build config and same version of glide(glide v4.0.0).
Here is my build config and glideModule class:
dependencies { annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0' compile 'com.github.bumptech.glide:glide:4.0.0' }
`@GlideModule
public class UxinGlideModule extends AppGlideModule {

@Override
public void applyOptions(Context context, GlideBuilder builder) {
    super.applyOptions(context, builder);
    builder.setDiskCache(new ExternalCacheDiskCacheFactory(context, 1024 * 1024 * 100))
            .setMemoryCache(new LruResourceCache(1024 * 1024 * 20))
            .setLogLevel(Log.ERROR);
}

@Override
public boolean isManifestParsingEnabled() {
    return false;
}

}`
Has anyone experience this question? How to fix it?

Have you tried this: press CTRL+F9 OR you can click on Make Project option in Build menu. It will generate one file automatically (You can see by pressing CTRL and hover on ClassName in File.

I have tried Make Project and rebuild, it generate GlideApp in build/generated, but just can not found the symbol. Have no idea why cannot resolve the symbol, but it is useful after build apk.

Few more reasons Glide app wont be generated

  1. If you copy GlideModule from another project make sure package name is correct

  2. If you are using kapt 'com.github.bumptech.glide:compiler:4.8.0' then make sure you add apply plugin: 'kotlin-kapt' on top

Maybe you should use the latest version of com.github.bumptech.glide:compiler.
e.g.

dependencies { 
    implementation('com.github.bumptech.glide:glide:4.7.1') {
        exclude group: 'com.android.support'
    }
    annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'   // use latest version
}

See here Kotlin guideline to Add Glide to Your App:
http://bumptech.github.io/glide/doc/generatedapi.html#kotlin
If you鈥檙e using Kotlin you can:
1. Implement all of Glide鈥檚 annotated classes (AppGlideModule, LibraryGlideModule, and GlideExtension) in Java as shown above.
2. Implement the annotated classes in Kotlin, but add a kapt dependency instead of an annotationProcessor dependency on Glide鈥檚 annotation processor:

Ok found out the cause after an hour of struggle . There was another issue in my project so my project was unable to build successfully , so GlideApp was not built hence showing this error . All the errors at the starting were of GlideApp and main error was hiding somewhere in the middle .

So guys if you did every thing i mentioned above and still getting this error the please check if there is some other issue in the project which is stopping build.

True. I observed the same.

Well In my case apply plugin: 'kotlin-kapt' caused the ERROR . .
So ,If you are usning it with only java, Removing kotlin-kapt plugin could solve your case . Thanks :)

There could be your project level error and just check at the bottom of the GlideApp error you will find the issue causing this. In my case, it was Parcelable POJO class which also extends RealmObject there was no public construction with no argument.

Was this page helpful?
0 / 5 - 0 ratings