Cannot resolve symbol 'GlideApp'
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
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’s 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.
我遇到一类这问题,其实是后面出现的错误引起的这个提示,仅仅是显示在前面,以为是GlideApp的错误,其实是后面的错误
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