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!
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.
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
@BindView(R.id.tv_option_one) TextView tv_option_one; @BindView(R.id.tv_option_two) TextView tv_option_two;
@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.
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'
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
add those dependencies like so
implementation 'com.github.bumptech.glide:glide:4.8.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
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.
In my case, I forgot to apply kapt plugin, So I just added it to my module-level
apply plugin: 'kotlin-kapt'
You can find more details about it – Glide Docs
If you are using DI, you could try comment out
GlideApp error code, then rebuild. IDE should you where the error truly is.
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