Reputation: 7733
I updated Android Studio from 2.x to 3.x last week end. The project migration was perfect, build was great. And now, from 2 hours, I can't explain why, I can't build, I have this error on Glide now:
Error:(26, 22) error: cannot find symbol class GlideApp
All was good before, I didn't change anything (gradle or configuration), and now this error appears...
For information about Glide, in my Gradle:
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC1'
compile 'com.github.bumptech.glide:glide:4.0.0-RC1'
compile 'com.github.bumptech.glide:okhttp3-integration:4.0.0-RC1'
The GlideApp file is generated automatically (I checked it).
So, it's a crazy situation. Thank you very much guys!
Upvotes: 15
Views: 17180
Reputation: 1
Generation of the following class worked for me:
import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.module.AppGlideModule;
@GlideModule
public final class MyAppGlideModule extends AppGlideModule {
// Dummy. Needed to generate GlideApp. See:
// GlideApp.with(service).
}
Upvotes: 0
Reputation: 2207
For me, the problem was that there was a different import error (which was a "valid" error, I had indeed deleted the referenced method).
But because I got like 20 messages that GlideApp
can't be found when building the app, I didn't even notice that there was such an error.
After correcting that error and rebuilding the project, everything worked normally again.
Upvotes: 0
Reputation: 101
This also happens when you have another error in your code. Gradle doesn't get to generate Glide classes since another error is thrown before it
Upvotes: 8
Reputation: 21
I got the solution of this issue.
Build -> Clean project (After) Rebuild Project
Then after you will able to import the GlideApp in your project
For Reference https://github.com/bumptech/glide/issues/1945
Upvotes: 0
Reputation: 296
If you are using DI, you could try comment out GlideApp
error code, then rebuild. IDE should you where the error truly is.
Upvotes: 1
Reputation: 10252
add those dependencies like so
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
Upvotes: 2
Reputation: 1336
In my case, I forgot to apply kapt plugin, So I just added it to my module-level build.gradle
.
apply plugin: 'kotlin-kapt'
You can find more details about it - Glide Docs
Upvotes: 1
Reputation: 7659
The same happened to me and it was one of weirdest errors I ever got, I used Butterknife in my project and I found out that if you define the views in private mode, you get this error
use:
@BindView(R.id.tv_option_one)
TextView tv_option_one;
@BindView(R.id.tv_option_two)
TextView tv_option_two;
instead of
@BindView(R.id.tv_option_one)
private TextView tv_option_one;
@BindView(R.id.tv_option_two)
private TextView tv_option_two;
it mostly happens when Butterknife can't find the view when you use bindView or the onClick annotation, and the worst part is that it shows errors everywhere except the place where they should be.
Upvotes: 7
Reputation: 5984
I ran into the same problem when I migrated to AndroidX. I ended up solving it by adding/updating the dependencies to
implementation 'com.github.bumptech.glide:glide:4.8.0-SNAPSHOT'
kapt 'com.github.bumptech.glide:compiler:4.8.0-SNAPSHOT'
kapt 'androidx.annotation:annotation:1.0.0-rc01'
Upvotes: 5
Reputation: 496
I have picked up this problem when a sub-package uses GlideApp with AppGlideModule being extended in a class one level up in the package hierarchy.
I suspect that the compiler tries to compile the sub-package classes before generating GlipeApp.
My solution was to extend AppGlideModule in a separate module and then add it as a dependency to all the modules using GlideApp.
Upvotes: 0
Reputation: 2005
Glide 4.x introduces some breaking changes. Be sure to follow the instructions in the Download & Setup page of Glide docs.
Do not neglect the changes in proguard.cfg
. After changes, rebuild your project and you should be able to access GlideApp
.
Upvotes: 3
Reputation: 28268
Some of these situations tend to pop up from time to time (for an instance with the generated class R
, where it ends up not being generated). The easiest way I have solved this in the past is to clean the project and rebuild it. And if that doesn't work, press File
in the top menu and press "Invalidate caches and restart". A second popup will appear, press "Invalidate caches and restart". It may take a while as Android Studio needs to re-index and rebuild the project, but it solves most issues I have had.
Upvotes: 12