I'm using 4.0.0-RC0, I added it by Gradle:
repositories {
mavenCentral() // jcenter() works as well because it pulls from Maven Central
}
dependencies {
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.github.bumptech.glide:glide:4.0.0-RC0'
compile 'com.android.support:support-v4:25.3.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC0'
}
I followed the here: https://github.com/bumptech/glide/tree/master/samples/svg/src/main/java/com/bumptech/glide/samples/svg
But when i try load SVG file to ImageView, i get error message: cannot resolve symbol 'GlideApp'
I think GlideApp class was not generated.
My source:
package com.example.quangson.glidesvg;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import static com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions.withCrossFade;
import android.graphics.drawable.PictureDrawable;
import android.net.Uri;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.bumptech.glide.RequestBuilder;
import com.caverock.androidsvg.SVGImageView;
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 RequestBuilderrequestBuilder;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
imageViewRes = (ImageView) findViewById(R.id.svg_image_view1);
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);
}
}
How to generate GlideApp class?
Please help
Any solution ? The same happens to me, adds both glide and annotationProcessor compiler glide
Please comment on your original issue, don't open new identical issues.
Let me know if following the instructions in #1939 doesn't help.
Edit: documentation was updated with Kotlin setup instructions: http://bumptech.github.io/glide/doc/generatedapi.html#kotlin
Just use android studio -> menu ->build ->Make Project ,then the GlideApp will generate in the build/generated/source.....
But I have another problem , I can't use the GlideApp in the kotlin class, when I build the app, gradle will 'KotlinExt.kt: Unresolved reference: GlideApp'
I have the same issue trying to use GlideApp from kotlin.
I am having same issue in Java also.
@niray @tmm1 please file a new issue for kotlin. I'm not especially familiar with the language so your largely on your own. If you do find a solution I'd definitely welcome a contribution.
@msquare097 See the duplicate issue #1939
@sjudd, there is no issue in your library.
I don't know what was the bug, i think there is a problem with android studio.
If there is error some where else in project, then it will point out your bug, while bug is not in your library.
And when I solved that bug it will compile and without any problem.
And to get the confident i repeat this cycle 3 times, and got the same case.
In short when there is error somewhere else in project, it will just point out error in your lib, when we solved that error, then it will run properly.
May be there can be issue with code generation.
It's just how javac works, at work we have multiple annotation processors and if we miss an import, or have a typo in variable name, it lists all the generated classes as unresolved symbol from all the different processors (e.g. Dagger 2). The real error message is hidden within tons of unrelated messages, so we need to scroll through all of them to find the problem.
@niray It's not working man !
http://bumptech.github.io/glide/
In glide 4 there is another options
I had the same issue and I found the solution right here on step 2:
http://bumptech.github.io/glide/doc/generatedapi.html
You must create a GlideModule and rebuild:
package com.example.myapp;
import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.module.AppGlideModule;
@GlideModule
public final class MyAppGlideModule extends AppGlideModule {}
Duplicate of #1939
+1
+2: I got the same isssue.
I solved by click Build->ReBuild Project. I don't know what to say this issue follow me several days.
Could you add these step in the document please, for we all use android studio 2.3.3 for the moment. It worth to do this step description.
File > Invalidate Caches / Restart
Rebuild project. Thats it..
guys facing the same issue GlideApp variable remains unresolved and when i am using Glide.load()... i am not able to set place holder ..Any of the above mentioned fixes are not working for me.
The generated API is not a requirement, it's just a little bit nicer syntax, see http://bumptech.github.io/glide/doc/options.html and http://bumptech.github.io/glide/doc/migrating.html.
That said, I haven't seen a case where the fixes suggested here and in the documentation don't work. If you've found a case, please attach a sample app that reproduces the problem.
For those experiencing this issue, also make sure annotationProcessor 'com.github.bumptech.glide:compiler:4.X.X is added to module level build.gradle
Also, make sure when using Kotlin, to use kapt instead of annotationProcessor
kapt 'com.github.bumptech.glide:compiler:4.x.x'
Finally Solved it. For Kotlin:
1) Make sure you're using kapt "com.github.bumptech.glide:compiler:4.x.x" instead of annotationProcessor "com.github.bumptech.glide:compiler:4.6.1".
2) Check that your Kotlin file inside of which you defined the @GlideModule annotated class and the class name are named exactly the same.
Example. The file is named GlideModule.kt and it contains the following:
@GlideModule
class GlideModule : AppGlideModule() {
}
3) Rebuild the project
Also make sure using @GlideModule instead of @GlideExtension when extending AppGlideModule
Well, same happened to me as well, ant it was one of wierdest error I ever got,
I used Butterkife 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;
instead of
@BindView(R.id.tv_option_one)
private TextView tv_option_one;
@BindView(R.id.tv_option_two)
private TextView tv_option_two;
I removed private, and now it's working
@PedroOkawa's comment solved my issue following what the own documentation states:
2. Include a AppGlideModule implementation in your application
Kotlin
Followed @vladostaci solution and added these lines to the proguard-rules.pro file in the app module:
-keep public class * extends com.bumptech.glide.module.AppGlideModule
-keep class com.bumptech.glide.GeneratedAppGlideModuleImpl
GlideApp shows after building the project!
I have tried all solutions. It is not working!!!!!!
I had the same problem.
I notice that Butterknife had problem with glide... i change my listerner from @OnLongClick to @OnClick and now is working.
Hi guys,
if you use Kotlin, make sure that the package name displayed at the top of the AppGlideModule.kt else it wont compile the file
I faced the same problem, And finally 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
I had everything there except for the line below in the top of my app's build.gradle.
apply plugin: 'kotlin-kapt'
According to the log provided by AS, we need:
两年后看到这里才知道原来是apt的问题
make sure:
Guys please fix this. GlideApp is not generated. We added annotation processor and implemented MyAppGlideModule. Tried rebuilding,c leaning, invalidating caches, ... nothing helps.
Found the issue - I needed to first comment out any existing GlideApp calls so project compiled and only after that I could revert the comments and now it's working. But man, so many hoops to jump through :/
@c0dehunter that's how Java's annotation processing works, sadly :(, if there's one error you get all of them reported... it's even worse when you have a project with heavy use of Dagger/Butterknife. A lifesaver to keep in mind: https://stackoverflow.com/a/35707023/253468 so you can find the one that shows the actual error to fix.
I solved this successfully:
First I created below class in my package:
import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.module.AppGlideModule;
@GlideModule
public class MyAppGlideModule extends AppGlideModule {
}
Then I rebuilt the project by going menu-->build-->rebuild project.
i'm using kotlin but none of them solve my problem
If you have Kotlin configured in project use kapt 'com.github.bumptech.glide:compiler:x.x.x'
I get the same error 3 times on the same day. I'm trying something out and solving the problem in a ridiculous way to self
I solved the error. This is not the cause of the error, you should look at the error codes should be somewhere else error. I made the mistake wrong because I used Butterknife, so this error came with it.
Also, make sure when using Kotlin, to use
kaptinstead ofannotationProcessor
kapt 'com.github.bumptech.glide:compiler:4.x.x'
love you <3
This worked for me:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android{.....
dependencies {...
Add the following dependencies:
kapt "android.arch.lifecycle:compiler:1.1.1"
kapt 'com.github.bumptech.glide:compiler:4.11.0'
implementation 'com.github.bumptech.glide:glide:4.11.0'
Please comment on your original issue, don't open new identical issues.
Let me know if following the instructions in #1939 doesn't help.
Edit: documentation was updated with Kotlin setup instructions: http://bumptech.github.io/glide/doc/generatedapi.html#kotlin
right brother
Most helpful comment
Just use android studio -> menu ->build ->Make Project ,then the GlideApp will generate in the build/generated/source.....
But I have another problem , I can't use the GlideApp in the kotlin class, when I build the app, gradle will 'KotlinExt.kt: Unresolved reference: GlideApp'